Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / ALinq / ParameterReplacerVisitor.cs / 1 / ParameterReplacerVisitor.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides an expression visitor that can replace a ParameterExpression. // // // @owner [....], [....] //--------------------------------------------------------------------- namespace System.Data.Services.Client { using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Diagnostics; ///Provides an expression visitor that can replace a internal class ParameterReplacerVisitor : ExpressionVisitor { ///. Expression to replace with. private Expression newExpression; ///Parameter to replace. private ParameterExpression oldParameter; ///Initializes a new /// Parameter to replace. /// Expression to replace with. private ParameterReplacerVisitor(ParameterExpression oldParameter, Expression newExpression) { this.oldParameter = oldParameter; this.newExpression = newExpression; } ///instance. /// Replaces the occurences of /// Expression to perform replacement on. /// Parameter to replace. /// Expression to replace with. ///for in /// . /// A new expression with the replacement performed. internal static Expression Replace(Expression expression, ParameterExpression oldParameter, Expression newExpression) { Debug.Assert(expression != null, "expression != null"); Debug.Assert(oldParameter != null, "oldParameter != null"); Debug.Assert(newExpression != null, "newExpression != null"); return new ParameterReplacerVisitor(oldParameter, newExpression).Visit(expression); } ///ParameterExpression visit method. /// The ParameterExpression expression to visit ///The visited ParameterExpression expression internal override Expression VisitParameter(ParameterExpression p) { if (p == this.oldParameter) { return this.newExpression; } else { return p; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides an expression visitor that can replace a ParameterExpression. // // // @owner [....], [....] //--------------------------------------------------------------------- namespace System.Data.Services.Client { using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Diagnostics; ///Provides an expression visitor that can replace a internal class ParameterReplacerVisitor : ExpressionVisitor { ///. Expression to replace with. private Expression newExpression; ///Parameter to replace. private ParameterExpression oldParameter; ///Initializes a new /// Parameter to replace. /// Expression to replace with. private ParameterReplacerVisitor(ParameterExpression oldParameter, Expression newExpression) { this.oldParameter = oldParameter; this.newExpression = newExpression; } ///instance. /// Replaces the occurences of /// Expression to perform replacement on. /// Parameter to replace. /// Expression to replace with. ///for in /// . /// A new expression with the replacement performed. internal static Expression Replace(Expression expression, ParameterExpression oldParameter, Expression newExpression) { Debug.Assert(expression != null, "expression != null"); Debug.Assert(oldParameter != null, "oldParameter != null"); Debug.Assert(newExpression != null, "newExpression != null"); return new ParameterReplacerVisitor(oldParameter, newExpression).Visit(expression); } ///ParameterExpression visit method. /// The ParameterExpression expression to visit ///The visited ParameterExpression expression internal override Expression VisitParameter(ParameterExpression p) { if (p == this.oldParameter) { return this.newExpression; } else { return p; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- serverconfig.cs
- Setter.cs
- MultiDataTrigger.cs
- FixedSOMFixedBlock.cs
- ProfileSettingsCollection.cs
- X509SecurityTokenProvider.cs
- XmlWrappingReader.cs
- TransformCryptoHandle.cs
- ChildrenQuery.cs
- RootProfilePropertySettingsCollection.cs
- FigureParagraph.cs
- Graph.cs
- SymDocumentType.cs
- OracleFactory.cs
- InvalidOperationException.cs
- Exceptions.cs
- SafeNativeMethods.cs
- WindowsAltTab.cs
- SplayTreeNode.cs
- IMembershipProvider.cs
- EdmValidator.cs
- SqlConnectionPoolProviderInfo.cs
- Int64Storage.cs
- PathGeometry.cs
- HttpException.cs
- FlowPosition.cs
- UnknownBitmapDecoder.cs
- CompositeCollectionView.cs
- PrintDialog.cs
- PointAnimationUsingPath.cs
- GridViewDeleteEventArgs.cs
- FamilyTypeface.cs
- DetailsViewInsertEventArgs.cs
- StatusBarDrawItemEvent.cs
- WebSysDescriptionAttribute.cs
- ObjectQuery_EntitySqlExtensions.cs
- TextDecorationUnitValidation.cs
- ConnectionManagementElement.cs
- DoubleConverter.cs
- RecognizedWordUnit.cs
- Run.cs
- Native.cs
- ConditionalAttribute.cs
- CrossSiteScriptingValidation.cs
- NTAccount.cs
- WindowsListViewGroupHelper.cs
- QuadraticBezierSegment.cs
- Brush.cs
- NamespaceInfo.cs
- OleDbMetaDataFactory.cs
- HttpException.cs
- MaskPropertyEditor.cs
- AgileSafeNativeMemoryHandle.cs
- AuthenticateEventArgs.cs
- GridViewSortEventArgs.cs
- SessionIDManager.cs
- DeviceSpecificDialogCachedState.cs
- SafeRightsManagementSessionHandle.cs
- ReturnType.cs
- DBCommand.cs
- OpenTypeCommon.cs
- CultureMapper.cs
- ADMembershipProvider.cs
- GrammarBuilderRuleRef.cs
- ObjectConverter.cs
- ConfigurationErrorsException.cs
- CounterNameConverter.cs
- DesignerAutoFormatCollection.cs
- WinFormsComponentEditor.cs
- OuterGlowBitmapEffect.cs
- templategroup.cs
- UnmanagedMemoryStream.cs
- ContentIterators.cs
- BufferedWebEventProvider.cs
- Pkcs7Signer.cs
- SrgsDocumentParser.cs
- Int16KeyFrameCollection.cs
- Random.cs
- DataGridViewTextBoxCell.cs
- CalendarDayButton.cs
- ProxyManager.cs
- EventEntry.cs
- DataKeyArray.cs
- DataRecordInfo.cs
- RemoteWebConfigurationHost.cs
- TextRangeAdaptor.cs
- ProcessInfo.cs
- RecognizedWordUnit.cs
- IndentedWriter.cs
- StringHandle.cs
- EntryWrittenEventArgs.cs
- RepeatButtonAutomationPeer.cs
- MessageVersionConverter.cs
- listitem.cs
- EpmCustomContentWriterNodeData.cs
- Token.cs
- EventInfo.cs
- BindingMAnagerBase.cs
- MenuItemCollection.cs
- SchemaCollectionCompiler.cs