Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- DbMetaDataFactory.cs
- SpotLight.cs
- Exception.cs
- LayoutTableCell.cs
- RootBrowserWindowAutomationPeer.cs
- Calendar.cs
- EditorPartDesigner.cs
- wmiprovider.cs
- KoreanCalendar.cs
- AliasedSlot.cs
- RemotingSurrogateSelector.cs
- ResXResourceSet.cs
- RequestUriProcessor.cs
- ItemDragEvent.cs
- ContentHostHelper.cs
- MatrixCamera.cs
- WebContext.cs
- LinearGradientBrush.cs
- HtmlInputReset.cs
- ChannelTerminatedException.cs
- UTF8Encoding.cs
- BitSet.cs
- DetailsViewRow.cs
- XamlParser.cs
- UrlAuthFailedErrorFormatter.cs
- ProxyWebPart.cs
- CatalogZoneDesigner.cs
- ValuePattern.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- EntityTypeEmitter.cs
- VersionedStreamOwner.cs
- ObjectKeyFrameCollection.cs
- XmlValidatingReader.cs
- _SslState.cs
- MD5.cs
- EmptyReadOnlyDictionaryInternal.cs
- RangeContentEnumerator.cs
- ConfigurationManager.cs
- XmlSchemaInfo.cs
- Conditional.cs
- DataSourceCache.cs
- CommonDialog.cs
- DataServiceEntityAttribute.cs
- ReadOnlyDictionary.cs
- ToolboxComponentsCreatingEventArgs.cs
- ComplexType.cs
- DataObject.cs
- HttpException.cs
- Models.cs
- WebServiceBindingAttribute.cs
- ProfileModule.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- AliasGenerator.cs
- XmlAttributes.cs
- OracleConnection.cs
- FieldMetadata.cs
- AutomationPropertyInfo.cs
- PropertyCondition.cs
- TaiwanCalendar.cs
- WorkflowApplicationIdleEventArgs.cs
- DrawTreeNodeEventArgs.cs
- SqlMethodAttribute.cs
- EncoderParameter.cs
- TextElement.cs
- BitmapImage.cs
- BaseCollection.cs
- ControlCollection.cs
- CodeCompiler.cs
- SeverityFilter.cs
- DayRenderEvent.cs
- HttpCookie.cs
- TableLayoutPanelResizeGlyph.cs
- HashHelper.cs
- _HelperAsyncResults.cs
- MsmqIntegrationSecurityMode.cs
- TaskForm.cs
- DiscoveryMessageSequenceGenerator.cs
- ReachUIElementCollectionSerializer.cs
- ClientApiGenerator.cs
- ConfigXmlComment.cs
- EncodingTable.cs
- ScrollProperties.cs
- KeyboardEventArgs.cs
- HtmlInputFile.cs
- PropertyPathConverter.cs
- Binding.cs
- Privilege.cs
- ControlHelper.cs
- PropertyMapper.cs
- RegexWriter.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- BackgroundFormatInfo.cs
- StandardBindingCollectionElement.cs
- CodeCatchClauseCollection.cs
- ClientConfigurationSystem.cs
- RowUpdatedEventArgs.cs
- FlowchartDesigner.Helpers.cs
- LinkedResource.cs
- DebugHandleTracker.cs
- Soap.cs