MethodInvokeExpression Class

Represents a method invocation expression.

public class MethodInvokeExpression : Expression

Example

var method = new MemberReferenceExpression(typeof(Console), "WriteLine");
var invoke = new MethodInvokeExpression(method, new LiteralExpression("Hello World"));

Assert.Equal("global::System.Console.WriteLine(\"Hello World\")", invoke.ToCsharpString());
Inheritance
Expression MethodInvokeExpression

Constructors

NameDescription
MethodInvokeExpression()
MethodInvokeExpression(Expression?)Initializes a new instance of the MethodInvokeExpression class with the specified method.
MethodInvokeExpression(Expression?, Expression[])Initializes a new instance of the MethodInvokeExpression class with the specified method and arguments.
MethodInvokeExpression(Expression?, TypeReference[]?, Expression[])Initializes a new instance of the MethodInvokeExpression class with the specified method, type parameters, and arguments.

MethodInvokeExpression overloads

MethodInvokeExpression()

MethodInvokeExpression.cs
public MethodInvokeExpression()

No documentation is available.

MethodInvokeExpression(Expression?)

MethodInvokeExpression.cs

Initializes a new instance of the MethodInvokeExpression class with the specified method.

public MethodInvokeExpression(Expression? method)
Parameters
method Expression?
The method to invoke.

MethodInvokeExpression(Expression?, Expression[])

MethodInvokeExpression.cs

Initializes a new instance of the MethodInvokeExpression class with the specified method and arguments.

public MethodInvokeExpression(Expression? method, params Expression[] arguments)
Parameters
method Expression?
The method to invoke.
arguments Expression[]
The method arguments.

MethodInvokeExpression(Expression?, TypeReference[]?, Expression[])

MethodInvokeExpression.cs

Initializes a new instance of the MethodInvokeExpression class with the specified method, type parameters, and arguments.

public MethodInvokeExpression(Expression? method, TypeReference[]? parameters, params Expression[] arguments)
Parameters
method Expression?
The method to invoke.
parameters TypeReference[]?
The generic type parameters for the method.
arguments Expression[]
The method arguments.

Properties

NameDescription
Arguments
Method
Parameters
public CodeObjectCollection<Expression> Arguments { get; }

No documentation is available.

public Expression? Method { get; set; }

Property value

Expression?

No documentation is available.

public IList<TypeReference> Parameters { get; }

Property value

IList<TypeReference>

No documentation is available.