Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- XmlEntityReference.cs
- CatalogZone.cs
- Panel.cs
- QilScopedVisitor.cs
- DataServiceQueryOfT.cs
- StreamWriter.cs
- WebSysDisplayNameAttribute.cs
- KeyNotFoundException.cs
- StructuredTypeInfo.cs
- TraceHandler.cs
- AnnouncementEndpointElement.cs
- ResourceManagerWrapper.cs
- DataRelationCollection.cs
- EnumUnknown.cs
- InternalTransaction.cs
- XsdDateTime.cs
- WebServiceEnumData.cs
- FormClosedEvent.cs
- LogConverter.cs
- NetStream.cs
- EncoderParameters.cs
- FontFamilyConverter.cs
- AppearanceEditorPart.cs
- FontEmbeddingManager.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- MachinePropertyVariants.cs
- DataGridViewLinkColumn.cs
- CachingHintValidation.cs
- PropertyConverter.cs
- HGlobalSafeHandle.cs
- QueryContinueDragEvent.cs
- GPStream.cs
- SQLCharsStorage.cs
- Simplifier.cs
- TypeSystem.cs
- HandlerBase.cs
- AdRotator.cs
- ToolStripRendererSwitcher.cs
- SecurityTokenValidationException.cs
- ErrorWrapper.cs
- DelegateSerializationHolder.cs
- RequestSecurityToken.cs
- Vector3dCollection.cs
- CollectionConverter.cs
- TextTreeExtractElementUndoUnit.cs
- CompositeDuplexBindingElementImporter.cs
- TCPClient.cs
- RootProjectionNode.cs
- Model3DGroup.cs
- NetTcpBindingElement.cs
- XsdDuration.cs
- FloaterBaseParaClient.cs
- PropertiesTab.cs
- ContextMenu.cs
- WindowsProgressbar.cs
- UInt64Storage.cs
- mansign.cs
- Win32Native.cs
- DataGridTable.cs
- StylusShape.cs
- CounterCreationData.cs
- HttpResponseInternalWrapper.cs
- ServiceHostingEnvironment.cs
- ScalarRestriction.cs
- RemoveStoryboard.cs
- ISAPIApplicationHost.cs
- WebPartZoneCollection.cs
- ConstructorNeedsTagAttribute.cs
- DebugInfoExpression.cs
- WebPageTraceListener.cs
- TableSectionStyle.cs
- MinimizableAttributeTypeConverter.cs
- GZipDecoder.cs
- GregorianCalendar.cs
- DrawingBrush.cs
- ArrayWithOffset.cs
- DocComment.cs
- CommandConverter.cs
- Int16AnimationBase.cs
- ApplicationDirectory.cs
- UITypeEditor.cs
- XmlSchemaAttributeGroup.cs
- PagerSettings.cs
- SoapSchemaImporter.cs
- SystemEvents.cs
- WebPart.cs
- webproxy.cs
- XmlSchemaGroupRef.cs
- BindingListCollectionView.cs
- DefaultObjectMappingItemCollection.cs
- oledbconnectionstring.cs
- dbenumerator.cs
- MemberCollection.cs
- ObjectDataSourceMethodEventArgs.cs
- RegexFCD.cs
- ObjectListDataBindEventArgs.cs
- BasicDesignerLoader.cs
- SqlClientMetaDataCollectionNames.cs
- ObjRef.cs
- SafeNativeMethodsOther.cs