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
- DecoderReplacementFallback.cs
- PriorityChain.cs
- StringStorage.cs
- Point4DValueSerializer.cs
- RelationshipManager.cs
- CodeObjectCreateExpression.cs
- XsltLibrary.cs
- SecurityPolicySection.cs
- TypeDefinition.cs
- TemplatedMailWebEventProvider.cs
- MasterPageParser.cs
- Vector3D.cs
- XPathDocumentBuilder.cs
- BypassElement.cs
- ScriptReference.cs
- FontDialog.cs
- UpdateCommandGenerator.cs
- SchemaLookupTable.cs
- ListControl.cs
- WorkflowInstanceQuery.cs
- KeyValueConfigurationCollection.cs
- BrowserInteropHelper.cs
- SimpleFieldTemplateUserControl.cs
- SkinBuilder.cs
- WindowsFormsHostPropertyMap.cs
- EntityDataSourceContextCreatedEventArgs.cs
- NetworkInformationException.cs
- XsdBuilder.cs
- NamespaceMapping.cs
- NTAccount.cs
- ConfigurationException.cs
- CodeTypeParameterCollection.cs
- ProcessingInstructionAction.cs
- SafeLibraryHandle.cs
- ScrollBar.cs
- SpeakCompletedEventArgs.cs
- DataListItem.cs
- CapabilitiesPattern.cs
- UnitySerializationHolder.cs
- HandledMouseEvent.cs
- DataBindingHandlerAttribute.cs
- FileDialogPermission.cs
- TreeNodeStyle.cs
- ClientBuildManagerCallback.cs
- VScrollProperties.cs
- EncryptedData.cs
- UpdatePanel.cs
- sapiproxy.cs
- KeyboardEventArgs.cs
- UpdateProgress.cs
- ControlParameter.cs
- OdbcReferenceCollection.cs
- KnownTypesProvider.cs
- PersonalizationProvider.cs
- WizardStepBase.cs
- RSAOAEPKeyExchangeDeformatter.cs
- ServiceModelActivity.cs
- SqlWorkflowInstanceStore.cs
- Schema.cs
- AuthenticateEventArgs.cs
- XmlDocument.cs
- ResourceSetExpression.cs
- AutoSizeToolBoxItem.cs
- DesignerOptionService.cs
- FontCacheLogic.cs
- SystemFonts.cs
- Int32Rect.cs
- HttpServerVarsCollection.cs
- PageThemeParser.cs
- Hex.cs
- CapabilitiesAssignment.cs
- RbTree.cs
- PriorityChain.cs
- CqlQuery.cs
- CounterSample.cs
- OneWayBindingElementImporter.cs
- FacetChecker.cs
- Mouse.cs
- PerfCounters.cs
- InputScopeConverter.cs
- BinaryObjectWriter.cs
- HorizontalAlignConverter.cs
- InvalidCommandTreeException.cs
- WebPartCancelEventArgs.cs
- IgnoreFileBuildProvider.cs
- Base64Encoding.cs
- SessionIDManager.cs
- ProfileProvider.cs
- PersonalizationStateInfoCollection.cs
- MultitargetUtil.cs
- XmlSerializerFactory.cs
- NameSpaceEvent.cs
- AsyncPostBackTrigger.cs
- RunWorkerCompletedEventArgs.cs
- RuleElement.cs
- DayRenderEvent.cs
- SimpleBitVector32.cs
- Tuple.cs
- WindowsFont.cs
- ExpressionBinding.cs