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
- Int16Converter.cs
- XmlValidatingReaderImpl.cs
- NameValuePermission.cs
- RemotingConfigParser.cs
- EditorPartChrome.cs
- MetabaseSettingsIis7.cs
- InheritedPropertyDescriptor.cs
- ChangeTracker.cs
- TemplatePartAttribute.cs
- MimeMultiPart.cs
- XmlNamedNodeMap.cs
- SemanticResultKey.cs
- RewritingProcessor.cs
- ReadOnlyTernaryTree.cs
- UpdatePanel.cs
- InputBindingCollection.cs
- NetworkAddressChange.cs
- CharacterHit.cs
- TableFieldsEditor.cs
- RelativeSource.cs
- PeerServiceMessageContracts.cs
- LabelLiteral.cs
- XmlSchemas.cs
- SignerInfo.cs
- UrlMappingsSection.cs
- GeometryDrawing.cs
- FormViewModeEventArgs.cs
- Stylesheet.cs
- UInt32Storage.cs
- CheckBox.cs
- CatalogPart.cs
- DBAsyncResult.cs
- BamlLocalizableResource.cs
- InvalidCommandTreeException.cs
- TextElementEditingBehaviorAttribute.cs
- ReferenceConverter.cs
- DbProviderFactory.cs
- _SingleItemRequestCache.cs
- ObjectConverter.cs
- SystemIPGlobalProperties.cs
- BindingGraph.cs
- SocketException.cs
- SpecularMaterial.cs
- SynchronizationContext.cs
- TemplatedMailWebEventProvider.cs
- MessageAction.cs
- HttpCachePolicy.cs
- NameNode.cs
- FaultHandlingFilter.cs
- BaseTemplateBuildProvider.cs
- TableItemPattern.cs
- VariableBinder.cs
- oledbmetadatacollectionnames.cs
- ResourcesChangeInfo.cs
- Accessors.cs
- SQLInt16Storage.cs
- EventHandlersStore.cs
- BaseDataBoundControl.cs
- ListView.cs
- IMembershipProvider.cs
- TextRangeProviderWrapper.cs
- ListControlConvertEventArgs.cs
- MiniParameterInfo.cs
- ClientSponsor.cs
- PagePropertiesChangingEventArgs.cs
- DataContractSerializerOperationFormatter.cs
- ConfigurationPropertyCollection.cs
- ZipIOLocalFileHeader.cs
- SafeHandles.cs
- ManagementScope.cs
- KoreanLunisolarCalendar.cs
- SystemIPv4InterfaceProperties.cs
- FastEncoder.cs
- HtmlFormWrapper.cs
- EntityContainerAssociationSetEnd.cs
- RsaSecurityToken.cs
- DbMetaDataColumnNames.cs
- KnownTypeDataContractResolver.cs
- DataTableNewRowEvent.cs
- validation.cs
- WebReferencesBuildProvider.cs
- SafeBitVector32.cs
- RegistryKey.cs
- XmlHierarchicalDataSourceView.cs
- ButtonBaseAutomationPeer.cs
- PageParserFilter.cs
- SafeMILHandle.cs
- ParagraphResult.cs
- AutomationPeer.cs
- OperatingSystem.cs
- Brush.cs
- DataGridTableCollection.cs
- BooleanKeyFrameCollection.cs
- UriTemplateTable.cs
- WebException.cs
- WebReferenceOptions.cs
- PtsCache.cs
- GroupBoxDesigner.cs
- altserialization.cs
- InternalBufferOverflowException.cs