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
- WebPageTraceListener.cs
- XamlPathDataSerializer.cs
- TimeEnumHelper.cs
- FlowSwitch.cs
- ExpressionNormalizer.cs
- tabpagecollectioneditor.cs
- EdgeModeValidation.cs
- CurrencyWrapper.cs
- CompilerGlobalScopeAttribute.cs
- DropShadowEffect.cs
- TimersDescriptionAttribute.cs
- SelectionPattern.cs
- HandleCollector.cs
- BlurEffect.cs
- ScrollEvent.cs
- propertytag.cs
- ExclusiveNamedPipeTransportManager.cs
- ItemCheckEvent.cs
- PassportPrincipal.cs
- ChannelServices.cs
- SelectionChangedEventArgs.cs
- mda.cs
- DBSqlParserColumn.cs
- DataGridViewCell.cs
- OperatingSystem.cs
- XmlElementCollection.cs
- SQLCharsStorage.cs
- IgnoreSectionHandler.cs
- NameTable.cs
- DataGridViewRowHeaderCell.cs
- OleDbConnectionFactory.cs
- XmlNamespaceMapping.cs
- StandardBindingCollectionElement.cs
- ActivityExecutor.cs
- ContextQuery.cs
- ClientBuildManagerCallback.cs
- LoginUtil.cs
- RequestQueue.cs
- AttachmentCollection.cs
- IsolatedStoragePermission.cs
- PrintPageEvent.cs
- ExpressionReplacer.cs
- TableColumnCollectionInternal.cs
- HandleCollector.cs
- ParameterSubsegment.cs
- MessagePropertyFilter.cs
- TextContainerChangeEventArgs.cs
- AlphabeticalEnumConverter.cs
- RequestCachingSection.cs
- ProgressBarBrushConverter.cs
- RegisteredDisposeScript.cs
- BoundPropertyEntry.cs
- DataGridViewMethods.cs
- DeferredReference.cs
- DataRelationCollection.cs
- EntityDataSourceDataSelectionPanel.cs
- IndexingContentUnit.cs
- DetailsViewPagerRow.cs
- SimpleWebHandlerParser.cs
- SqlWebEventProvider.cs
- NullableIntAverageAggregationOperator.cs
- ColorContext.cs
- Panel.cs
- OracleRowUpdatingEventArgs.cs
- ArrayWithOffset.cs
- ComponentResourceKeyConverter.cs
- XmlSchemaDatatype.cs
- ToggleButtonAutomationPeer.cs
- ReachSerializableProperties.cs
- XpsPackagingPolicy.cs
- RoutedEventConverter.cs
- UnicodeEncoding.cs
- SerializationTrace.cs
- ActivityExecutor.cs
- ObjectPersistData.cs
- GregorianCalendarHelper.cs
- altserialization.cs
- InheritedPropertyDescriptor.cs
- QuestionEventArgs.cs
- AbstractSvcMapFileLoader.cs
- TreeView.cs
- DataSourceGroupCollection.cs
- FrameworkObject.cs
- EntitySqlQueryBuilder.cs
- MobileUITypeEditor.cs
- DataObjectFieldAttribute.cs
- CacheMemory.cs
- FixedLineResult.cs
- SocketPermission.cs
- SrgsRule.cs
- FormsAuthenticationUser.cs
- KeyValueInternalCollection.cs
- ValueProviderWrapper.cs
- UnsafePeerToPeerMethods.cs
- ProfileGroupSettings.cs
- UriExt.cs
- DocumentPropertiesDialog.cs
- UInt64Converter.cs
- RequestCachePolicyConverter.cs
- FamilyTypeface.cs