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
- GradientBrush.cs
- KeyNotFoundException.cs
- UpdatePanelTrigger.cs
- AutoResetEvent.cs
- SQLString.cs
- LayoutTableCell.cs
- TextBreakpoint.cs
- PerformanceCounter.cs
- FormsAuthenticationCredentials.cs
- ValidatorCompatibilityHelper.cs
- _LazyAsyncResult.cs
- GlyphsSerializer.cs
- XdrBuilder.cs
- CodePageUtils.cs
- __ComObject.cs
- SQLInt16Storage.cs
- XmlBinaryWriter.cs
- OpenFileDialog.cs
- PackageDigitalSignatureManager.cs
- DataGridViewBindingCompleteEventArgs.cs
- KeyValueSerializer.cs
- regiisutil.cs
- XmlExceptionHelper.cs
- SafeThemeHandle.cs
- RequiredFieldValidator.cs
- ListChangedEventArgs.cs
- UpdateEventArgs.cs
- SamlSubjectStatement.cs
- TreeView.cs
- _SingleItemRequestCache.cs
- DbSetClause.cs
- MyContact.cs
- ItemsPresenter.cs
- SafeThreadHandle.cs
- DataGridViewColumnStateChangedEventArgs.cs
- SignalGate.cs
- ViewManagerAttribute.cs
- HttpRequestCacheValidator.cs
- QuadraticBezierSegment.cs
- SqlDataSourceCommandParser.cs
- XmlDocumentSurrogate.cs
- CodeNamespaceCollection.cs
- PostBackOptions.cs
- LogLogRecord.cs
- TreeViewItemAutomationPeer.cs
- LocalTransaction.cs
- XhtmlConformanceSection.cs
- BinaryFormatter.cs
- ViewGenerator.cs
- TripleDES.cs
- XmlSchemaFacet.cs
- GenerateTemporaryAssemblyTask.cs
- Root.cs
- FloaterBaseParagraph.cs
- X509InitiatorCertificateServiceElement.cs
- DynamicILGenerator.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- TypeContext.cs
- SQLBytesStorage.cs
- ArglessEventHandlerProxy.cs
- SimpleWebHandlerParser.cs
- ActionFrame.cs
- DataSourceSelectArguments.cs
- SchemaDeclBase.cs
- TextElementAutomationPeer.cs
- parserscommon.cs
- StrokeCollectionConverter.cs
- EditorPartChrome.cs
- TextBox.cs
- RepeatBehaviorConverter.cs
- Connector.cs
- SmiSettersStream.cs
- CSharpCodeProvider.cs
- PolyBezierSegment.cs
- Style.cs
- DataGridSortCommandEventArgs.cs
- SqlDataSource.cs
- FormViewUpdatedEventArgs.cs
- AsyncDataRequest.cs
- EnumBuilder.cs
- AbsoluteQuery.cs
- DataGridColumnFloatingHeader.cs
- CodeBinaryOperatorExpression.cs
- FrameworkTextComposition.cs
- HttpModuleCollection.cs
- JsonReader.cs
- BitmapImage.cs
- FreezableDefaultValueFactory.cs
- VisualState.cs
- DataGridViewRowEventArgs.cs
- EncoderBestFitFallback.cs
- IndividualDeviceConfig.cs
- IdentityValidationException.cs
- CallSiteOps.cs
- Inline.cs
- ActiveXContainer.cs
- CounterSetInstanceCounterDataSet.cs
- StopStoryboard.cs
- autovalidator.cs
- SymbolPair.cs