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
- GridSplitter.cs
- Tracer.cs
- MsmqProcessProtocolHandler.cs
- HtmlElementErrorEventArgs.cs
- HttpResponseHeader.cs
- IDispatchConstantAttribute.cs
- ScrollContentPresenter.cs
- PolyQuadraticBezierSegment.cs
- TimeoutException.cs
- DecimalStorage.cs
- ListViewDeletedEventArgs.cs
- ArcSegment.cs
- XmlIgnoreAttribute.cs
- WhiteSpaceTrimStringConverter.cs
- BaseInfoTable.cs
- PersonalizationStateInfoCollection.cs
- SerializationStore.cs
- SqlDependencyListener.cs
- WebExceptionStatus.cs
- BitmapEffectOutputConnector.cs
- KeyboardNavigation.cs
- RemoteWebConfigurationHostServer.cs
- DataBinder.cs
- ImageAutomationPeer.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- ExecutorLocksHeldException.cs
- FaultContext.cs
- DocumentReference.cs
- ScriptingJsonSerializationSection.cs
- ModifierKeysConverter.cs
- cookieexception.cs
- RegexRunner.cs
- ListControl.cs
- MexHttpBindingCollectionElement.cs
- UnsafeNativeMethods.cs
- CachedFontFace.cs
- DataGridViewEditingControlShowingEventArgs.cs
- SessionParameter.cs
- ProtectedConfigurationSection.cs
- ScrollProviderWrapper.cs
- WebFaultException.cs
- initElementDictionary.cs
- XmlImplementation.cs
- Keyboard.cs
- DocumentApplicationJournalEntry.cs
- SmtpClient.cs
- PropertyTab.cs
- ViewManager.cs
- TextBounds.cs
- PerspectiveCamera.cs
- DependencyPropertyDescriptor.cs
- ComPersistableTypeElement.cs
- RtfToXamlReader.cs
- StrongName.cs
- MenuTracker.cs
- Point3D.cs
- ObjectRef.cs
- TextEffectResolver.cs
- ReadOnlyCollection.cs
- ObjectSet.cs
- EventSetter.cs
- HtmlGenericControl.cs
- PageEventArgs.cs
- _NativeSSPI.cs
- DataListDesigner.cs
- coordinatorscratchpad.cs
- Storyboard.cs
- MeasurementDCInfo.cs
- ResourceType.cs
- BuildProviderCollection.cs
- SkewTransform.cs
- HandlerMappingMemo.cs
- FileAccessException.cs
- SqlConnection.cs
- ValueExpressions.cs
- OrCondition.cs
- PnrpPermission.cs
- GridViewDeletedEventArgs.cs
- DataGridItemAttachedStorage.cs
- AuthenticationModuleElement.cs
- PartitionedStreamMerger.cs
- HtmlTableRowCollection.cs
- CustomError.cs
- ExpressionContext.cs
- prompt.cs
- RoleBoolean.cs
- DataControlFieldHeaderCell.cs
- PermissionAttributes.cs
- StorageModelBuildProvider.cs
- ServiceDescription.cs
- SqlMethods.cs
- ClientSideProviderDescription.cs
- DesignerActionListCollection.cs
- QilGenerator.cs
- NativeMethods.cs
- SrgsDocument.cs
- MessageFilterException.cs
- ListViewCommandEventArgs.cs
- webclient.cs
- Context.cs