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
- CompositeScriptReferenceEventArgs.cs
- CustomErrorsSection.cs
- ControlPropertyNameConverter.cs
- PeerNodeTraceRecord.cs
- ReverseInheritProperty.cs
- KeyEvent.cs
- Stopwatch.cs
- ConsumerConnectionPointCollection.cs
- Point.cs
- TTSEvent.cs
- FilterElement.cs
- Polyline.cs
- PtsHost.cs
- IdentityReference.cs
- ClientReliableChannelBinder.cs
- ValidatedControlConverter.cs
- LoginNameDesigner.cs
- WebHttpElement.cs
- SiteMapPath.cs
- TabletDevice.cs
- Mappings.cs
- AsymmetricKeyExchangeDeformatter.cs
- CompoundFileReference.cs
- WizardPanelChangingEventArgs.cs
- Events.cs
- ControlType.cs
- CollectionViewProxy.cs
- QuotaExceededException.cs
- RNGCryptoServiceProvider.cs
- SimpleType.cs
- WindowProviderWrapper.cs
- BaseResourcesBuildProvider.cs
- CodeTypeConstructor.cs
- PrinterSettings.cs
- SurrogateSelector.cs
- InputBinding.cs
- ListDictionaryInternal.cs
- Animatable.cs
- MachineKey.cs
- TableLayoutColumnStyleCollection.cs
- Symbol.cs
- StorageMappingItemCollection.cs
- SrgsSubset.cs
- InputLanguageSource.cs
- LinkDescriptor.cs
- TextAutomationPeer.cs
- ConfigXmlComment.cs
- CompilerState.cs
- ReservationNotFoundException.cs
- WorkflowMarkupSerializationManager.cs
- ObjectReaderCompiler.cs
- BooleanStorage.cs
- GlobalProxySelection.cs
- _RequestCacheProtocol.cs
- UrlMappingCollection.cs
- CodeSnippetTypeMember.cs
- CompilationLock.cs
- BaseComponentEditor.cs
- PenThread.cs
- IntellisenseTextBox.designer.cs
- DockPattern.cs
- CodeValidator.cs
- EventWaitHandleSecurity.cs
- NavigationEventArgs.cs
- DataGridItemEventArgs.cs
- PerformanceCounter.cs
- WasEndpointConfigContainer.cs
- PathTooLongException.cs
- ExclusiveCanonicalizationTransform.cs
- UserInitiatedNavigationPermission.cs
- DockingAttribute.cs
- StringComparer.cs
- ListMarkerLine.cs
- SpellerError.cs
- MultiSelector.cs
- DecimalAnimationUsingKeyFrames.cs
- HostingPreferredMapPath.cs
- RuntimeConfig.cs
- BooleanAnimationUsingKeyFrames.cs
- ListItemCollection.cs
- QilStrConcat.cs
- RightsManagementProvider.cs
- StateMachine.cs
- SqlInternalConnectionSmi.cs
- MenuItemBinding.cs
- NameSpaceExtractor.cs
- TreeNodeClickEventArgs.cs
- TranslateTransform.cs
- GridViewDeleteEventArgs.cs
- BoolExpressionVisitors.cs
- DirtyTextRange.cs
- WebPart.cs
- Translator.cs
- BatchWriter.cs
- Int32Rect.cs
- CodeSubDirectoriesCollection.cs
- HttpRawResponse.cs
- Misc.cs
- SerializerWriterEventHandlers.cs
- MatchingStyle.cs