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
- AutomationEventArgs.cs
- Monitor.cs
- LineSegment.cs
- VectorValueSerializer.cs
- SQLStringStorage.cs
- URL.cs
- CreateUserErrorEventArgs.cs
- SafeFileMappingHandle.cs
- NonVisualControlAttribute.cs
- Serializer.cs
- ReadOnlyState.cs
- ComplexBindingPropertiesAttribute.cs
- _NestedSingleAsyncResult.cs
- DoubleCollectionConverter.cs
- TextCompositionManager.cs
- KeyValueSerializer.cs
- RawStylusInputCustomDataList.cs
- Array.cs
- ExecutionContext.cs
- SqlDataSourceCache.cs
- GenericTypeParameterBuilder.cs
- RandomNumberGenerator.cs
- DetailsViewCommandEventArgs.cs
- SqlProcedureAttribute.cs
- PkcsUtils.cs
- ValuePattern.cs
- ColumnCollection.cs
- FrugalList.cs
- RSAOAEPKeyExchangeDeformatter.cs
- XmlStringTable.cs
- TempEnvironment.cs
- VersionPair.cs
- PointValueSerializer.cs
- Rotation3DAnimation.cs
- safex509handles.cs
- TypeForwardedFromAttribute.cs
- SafeSecurityHelper.cs
- HtmlInputPassword.cs
- SmtpSection.cs
- ScrollItemProviderWrapper.cs
- Compiler.cs
- ToolStripContentPanel.cs
- PriorityChain.cs
- RtfFormatStack.cs
- DBAsyncResult.cs
- DependencyPropertyKey.cs
- Point3DAnimation.cs
- HtmlTextArea.cs
- UriTemplateLiteralPathSegment.cs
- XMLSyntaxException.cs
- SafeRightsManagementQueryHandle.cs
- safemediahandle.cs
- DelegatedStream.cs
- Attributes.cs
- Model3DGroup.cs
- CodeIdentifier.cs
- RichTextBoxContextMenu.cs
- PackUriHelper.cs
- SingleConverter.cs
- ModelItemExtensions.cs
- FaultDesigner.cs
- DataGridDetailsPresenterAutomationPeer.cs
- RectAnimationUsingKeyFrames.cs
- ControlsConfig.cs
- StreamWriter.cs
- DecoderNLS.cs
- PkcsMisc.cs
- TextTreeObjectNode.cs
- ItemPager.cs
- iisPickupDirectory.cs
- Debug.cs
- GridViewRowEventArgs.cs
- _HTTPDateParse.cs
- x509store.cs
- PerformanceCounterPermissionEntry.cs
- SymDocumentType.cs
- PartitionerQueryOperator.cs
- Transform.cs
- DataGridViewRowPostPaintEventArgs.cs
- PropertyGridCommands.cs
- OdbcParameter.cs
- ConnectionsZoneAutoFormat.cs
- ReturnEventArgs.cs
- UserPersonalizationStateInfo.cs
- ImageClickEventArgs.cs
- VectorAnimationBase.cs
- Tracer.cs
- SaveLedgerEntryRequest.cs
- MailAddress.cs
- SafeNativeMethodsOther.cs
- CustomValidator.cs
- LogEntrySerializer.cs
- ProviderCommandInfoUtils.cs
- PageAsyncTaskManager.cs
- RegexCompilationInfo.cs
- BackgroundWorker.cs
- DataViewManagerListItemTypeDescriptor.cs
- altserialization.cs
- DeviceContext2.cs
- OleDbInfoMessageEvent.cs