//------------------------------------------------------------------------------ // // // Microsoft // Copyright (c) Microsoft Corporation. All rights reserved. // //------------------------------------------------------------------------------ namespace System.CodeDom { using System.Diagnostics; using System; using Microsoft.Win32; using System.Collections; using System.Runtime.InteropServices; /// /// /// Represents an /// expression to invoke a method, to be called on a given target. /// /// [ ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable, ] public class CodeMethodInvokeExpression : CodeExpression { private CodeMethodReferenceExpression method; private CodeExpressionCollection parameters = new CodeExpressionCollection(); /// /// /// Initializes a new instance of . /// /// public CodeMethodInvokeExpression() { } /// /// /// Initializes a new instance of using the specified target object, method name /// and parameters. /// /// public CodeMethodInvokeExpression(CodeMethodReferenceExpression method, params CodeExpression[] parameters) { this.method = method; Parameters.AddRange(parameters); } /// /// [To be supplied.] /// public CodeMethodInvokeExpression(CodeExpression targetObject, string methodName, params CodeExpression[] parameters) { this.method = new CodeMethodReferenceExpression(targetObject, methodName); Parameters.AddRange(parameters); } /// /// /// Gets or sets the name of the method to invoke. /// /// public CodeMethodReferenceExpression Method { get { if (method == null) { method = new CodeMethodReferenceExpression(); } return method; } set { method = value; } } /// /// /// Gets or sets /// the parameters to invoke the method with. /// /// public CodeExpressionCollection Parameters { get { return parameters; } } } }