Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / ALinq / ParameterReplacerVisitor.cs / 1305376 / 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.Diagnostics; using System.Linq.Expressions; ///Provides an expression visitor that can replace a internal class ParameterReplacerVisitor : ALinqExpressionVisitor { ///. 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.Diagnostics; using System.Linq.Expressions; ///Provides an expression visitor that can replace a internal class ParameterReplacerVisitor : ALinqExpressionVisitor { ///. 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
- CollectionChange.cs
- XPathQilFactory.cs
- SharedConnectionInfo.cs
- PostBackOptions.cs
- InputProcessorProfiles.cs
- ComponentCollection.cs
- EventSinkActivity.cs
- XmlBinaryReaderSession.cs
- TextTreeRootNode.cs
- TimeStampChecker.cs
- IQueryable.cs
- ResourcesChangeInfo.cs
- PassportIdentity.cs
- DbMetaDataCollectionNames.cs
- TargetException.cs
- WindowsFormsHelpers.cs
- DesignTimeData.cs
- codemethodreferenceexpression.cs
- ConversionContext.cs
- InvokeGenerator.cs
- DataListItemEventArgs.cs
- DependencyPropertyValueSerializer.cs
- _FtpControlStream.cs
- WsatConfiguration.cs
- ZipIORawDataFileBlock.cs
- EventLogger.cs
- ObjectQueryExecutionPlan.cs
- WpfKnownMemberInvoker.cs
- AdRotator.cs
- HScrollProperties.cs
- CurrentChangedEventManager.cs
- DataSourceDesigner.cs
- NavigatorOutput.cs
- XsltSettings.cs
- OrderByQueryOptionExpression.cs
- SystemMulticastIPAddressInformation.cs
- CollectionType.cs
- IISMapPath.cs
- TileBrush.cs
- documentsequencetextview.cs
- FontResourceCache.cs
- NamespaceCollection.cs
- TextServicesProperty.cs
- Pointer.cs
- Tracer.cs
- DynamicActionMessageFilter.cs
- InputReportEventArgs.cs
- CorePropertiesFilter.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- Operator.cs
- RegistrationProxy.cs
- ExpressionBuilderCollection.cs
- CompositeDataBoundControl.cs
- newitemfactory.cs
- TreeViewDesigner.cs
- FixUpCollection.cs
- PublisherMembershipCondition.cs
- XmlSerializerOperationGenerator.cs
- Misc.cs
- XmlValidatingReaderImpl.cs
- Light.cs
- WindowsPrincipal.cs
- _AuthenticationState.cs
- SafeSecurityHandles.cs
- Matrix3D.cs
- ProcessThread.cs
- PolyBezierSegment.cs
- CngProvider.cs
- XmlWrappingWriter.cs
- TextBox.cs
- ControlPager.cs
- PrimaryKeyTypeConverter.cs
- SQLInt64.cs
- CapabilitiesRule.cs
- MLangCodePageEncoding.cs
- SoapTypeAttribute.cs
- Object.cs
- CommandID.cs
- WhitespaceRule.cs
- MatrixTransform.cs
- KnownTypesProvider.cs
- ProtocolsSection.cs
- InheritanceAttribute.cs
- CreateSequenceResponse.cs
- Schema.cs
- GatewayIPAddressInformationCollection.cs
- CodeAttributeDeclarationCollection.cs
- WebControlParameterProxy.cs
- EncryptedKey.cs
- SystemPens.cs
- ServiceDescription.cs
- CustomTypeDescriptor.cs
- DesignerTransactionCloseEvent.cs
- Stylus.cs
- SessionSwitchEventArgs.cs
- XmlSchemaElement.cs
- CleanUpVirtualizedItemEventArgs.cs
- HelpEvent.cs
- SpecialFolderEnumConverter.cs
- PersonalizationStateInfo.cs