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
- ListView.cs
- PathFigureCollection.cs
- DataTableTypeConverter.cs
- RTLAwareMessageBox.cs
- ToolStripStatusLabel.cs
- OleDbCommandBuilder.cs
- ContentPosition.cs
- XmlElementList.cs
- BaseValidatorDesigner.cs
- ReferenceConverter.cs
- Expressions.cs
- NavigatorInput.cs
- NewArrayExpression.cs
- ControlType.cs
- NativeActivityAbortContext.cs
- MultipartIdentifier.cs
- BaseInfoTable.cs
- ProcessThreadCollection.cs
- EraserBehavior.cs
- DataGridViewRowStateChangedEventArgs.cs
- MediaCommands.cs
- SoapSchemaExporter.cs
- ToolStripHighContrastRenderer.cs
- TextWriter.cs
- EventToken.cs
- UnsafeNativeMethods.cs
- DynamicValueConverter.cs
- ADMembershipProvider.cs
- CodeCatchClauseCollection.cs
- UnionCodeGroup.cs
- brushes.cs
- SByte.cs
- ScriptBehaviorDescriptor.cs
- odbcmetadatacolumnnames.cs
- DataViewManagerListItemTypeDescriptor.cs
- XmlWriter.cs
- XmlIterators.cs
- HtmlContainerControl.cs
- SymbolMethod.cs
- MouseActionValueSerializer.cs
- AstNode.cs
- _CommandStream.cs
- VirtualizedContainerService.cs
- DbProviderFactory.cs
- CustomValidator.cs
- DatePickerDateValidationErrorEventArgs.cs
- Assembly.cs
- WindowsClaimSet.cs
- ScrollChangedEventArgs.cs
- WebSysDescriptionAttribute.cs
- QuadraticBezierSegment.cs
- HttpPostProtocolReflector.cs
- CodeCommentStatementCollection.cs
- ApplicationManager.cs
- SpellerStatusTable.cs
- SqlLiftIndependentRowExpressions.cs
- Fonts.cs
- FileSystemWatcher.cs
- SectionRecord.cs
- TaiwanLunisolarCalendar.cs
- TransformerInfo.cs
- XmlAggregates.cs
- PrivilegedConfigurationManager.cs
- ServiceModelConfigurationElementCollection.cs
- SymmetricCryptoHandle.cs
- TextSelectionProcessor.cs
- BaseCollection.cs
- MessageBox.cs
- WinCategoryAttribute.cs
- SchemaImporterExtensionElement.cs
- DataServiceOperationContext.cs
- BinaryFormatterWriter.cs
- ListBoxChrome.cs
- DispatcherFrame.cs
- ServiceManager.cs
- FrameworkReadOnlyPropertyMetadata.cs
- DoWorkEventArgs.cs
- PointCollectionValueSerializer.cs
- SoapCodeExporter.cs
- TextEditorTables.cs
- MouseButton.cs
- ModelVisual3D.cs
- XmlCharCheckingWriter.cs
- CodeConstructor.cs
- TimeoutHelper.cs
- IsolatedStorage.cs
- WindowsFormsHostPropertyMap.cs
- SymmetricSecurityProtocol.cs
- Completion.cs
- XmlAttributes.cs
- ToolboxItem.cs
- MD5Cng.cs
- BindingGroup.cs
- HostProtectionException.cs
- InputQueue.cs
- DoubleConverter.cs
- Point.cs
- ChannelEndpointElement.cs
- XmlMembersMapping.cs
- DataGridViewUtilities.cs