Expression.Call 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
MethodCallExpression 항목을 만듭니다.
오버로드
Call(MethodInfo, Expression, Expression, Expression, Expression, Expression)
MethodCallExpression 5개의 인수를 사용하는 정적 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Reflection::MethodInfo ^ method, System::Linq::Expressions::Expression ^ arg0, System::Linq::Expressions::Expression ^ arg1, System::Linq::Expressions::Expression ^ arg2, System::Linq::Expressions::Expression ^ arg3, System::Linq::Expressions::Expression ^ arg4);
public static System.Linq.Expressions.MethodCallExpression Call(System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0, System.Linq.Expressions.Expression arg1, System.Linq.Expressions.Expression arg2, System.Linq.Expressions.Expression arg3, System.Linq.Expressions.Expression arg4);
static member Call : System.Reflection.MethodInfo * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (method As MethodInfo, arg0 As Expression, arg1 As Expression, arg2 As Expression, arg3 As Expression, arg4 As Expression) As MethodCallExpression
매개 변수
- method
- MethodInfo
MethodInfo 속성을 같게 Method 설정하는 A입니다.
- arg0
- Expression
Expression 첫 번째 인수를 나타내는 값입니다.
- arg1
- Expression
Expression 두 번째 인수를 나타내는 값입니다.
- arg2
- Expression
Expression 세 번째 인수를 나타내는 값입니다.
- arg3
- Expression
Expression 네 번째 인수를 나타내는 값입니다.
- arg4
- Expression
Expression 다섯 번째 인수를 나타내는 값입니다.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object 지정된 값으로 설정된 속성과 Method 속성이 있는 A입니다.
예외
method가 null입니다.
적용 대상
Call(Expression, MethodInfo, Expression, Expression, Expression)
세 개의 MethodCallExpression 인수를 사용하는 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Linq::Expressions::Expression ^ instance, System::Reflection::MethodInfo ^ method, System::Linq::Expressions::Expression ^ arg0, System::Linq::Expressions::Expression ^ arg1, System::Linq::Expressions::Expression ^ arg2);
public static System.Linq.Expressions.MethodCallExpression Call(System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0, System.Linq.Expressions.Expression arg1, System.Linq.Expressions.Expression arg2);
static member Call : System.Linq.Expressions.Expression * System.Reflection.MethodInfo * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (instance As Expression, method As MethodInfo, arg0 As Expression, arg1 As Expression, arg2 As Expression) As MethodCallExpression
매개 변수
- instance
- Expression
Expression 인스턴스 호출의 인스턴스를 지정하는 형식입니다. (정적(Visual Basic에서 공유) 메서드에 대해 null을 전달합니다.
- method
- MethodInfo
MethodInfo 대상 메서드를 나타내는 값입니다.
- arg0
- Expression
Expression 첫 번째 인수를 나타내는 값입니다.
- arg1
- Expression
Expression 두 번째 인수를 나타내는 값입니다.
- arg2
- Expression
Expression 세 번째 인수를 나타내는 값입니다.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object 지정된 값으로 설정된 속성과 Method 속성이 있는 A입니다.
적용 대상
Call(Type, String, Type[], Expression[])
MethodCallExpression 적절한 팩터리 메서드를 호출하여 static (SharedVisual Basic에서) 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(Type ^ type, System::String ^ methodName, cli::array <Type ^> ^ typeArguments, ... cli::array <System::Linq::Expressions::Expression ^> ^ arguments);
public static System.Linq.Expressions.MethodCallExpression Call(Type type, string methodName, Type[] typeArguments, params System.Linq.Expressions.Expression[] arguments);
static member Call : Type * string * Type[] * System.Linq.Expressions.Expression[] -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (type As Type, methodName As String, typeArguments As Type(), ParamArray arguments As Expression()) As MethodCallExpression
매개 변수
- type
- Type
지정된 static (Shared Visual Basic에서) 메서드를 포함하는 형식입니다.
- methodName
- String
메서드의 이름입니다.
- typeArguments
- Type[]
제네릭 메서드의 Type 형식 매개 변수를 지정하는 개체의 배열입니다. methodName이 제네릭이 아닌 메서드를 지정하는 경우 이 인수는 null이어야 합니다.
- arguments
- Expression[]
메서드에 대한 Expression 인수를 나타내는 개체의 배열입니다.
반품
MethodCallExpression 속성이 같은 NodeTypeCall A, Method 지정된 MethodInfo (staticVisual Basic에서) 메서드를 나타내는 속성으로 설정된 Shared 속성 및 Arguments 지정된 인수로 설정된 속성입니다.
예외
type 또는 methodName .입니다 null.
이름이고 형식 매개 변수가 methodName일치 typeArguments하며 매개 변수 형식이 일치하는 arguments 메서드가 없거나 해당 기본 형식에 type 있는 메서드가 없습니다.
-또는-
이름이고, 형식 매개 변수가 methodName일치 typeArguments하고, 매개 변수 형식이 일치하는 arguments 메서드가 두 개 이상 있거나 해당 기본 형식에 type 있습니다.
설명
결과 Type 속성은 MethodCallExpression 로 표시된 메서드의 반환 형식과 methodName같습니다.
Object 속성은 null입니다.
적용 대상
Call(MethodInfo, Expression, Expression, Expression)
세 개의 MethodCallExpression 인수를 사용하는 정적 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Reflection::MethodInfo ^ method, System::Linq::Expressions::Expression ^ arg0, System::Linq::Expressions::Expression ^ arg1, System::Linq::Expressions::Expression ^ arg2);
public static System.Linq.Expressions.MethodCallExpression Call(System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0, System.Linq.Expressions.Expression arg1, System.Linq.Expressions.Expression arg2);
static member Call : System.Reflection.MethodInfo * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (method As MethodInfo, arg0 As Expression, arg1 As Expression, arg2 As Expression) As MethodCallExpression
매개 변수
- method
- MethodInfo
MethodInfo 속성을 같게 Method 설정하는 A입니다.
- arg0
- Expression
Expression 첫 번째 인수를 나타내는 값입니다.
- arg1
- Expression
Expression 두 번째 인수를 나타내는 값입니다.
- arg2
- Expression
Expression 세 번째 인수를 나타내는 값입니다.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object 지정된 값으로 설정된 속성과 Method 속성이 있는 A입니다.
예외
method가 null입니다.
적용 대상
Call(Expression, String, Type[], Expression[])
적절한 팩터리 MethodCallExpression 메서드를 호출하여 메서드 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Linq::Expressions::Expression ^ instance, System::String ^ methodName, cli::array <Type ^> ^ typeArguments, ... cli::array <System::Linq::Expressions::Expression ^> ^ arguments);
public static System.Linq.Expressions.MethodCallExpression Call(System.Linq.Expressions.Expression instance, string methodName, Type[] typeArguments, params System.Linq.Expressions.Expression[] arguments);
static member Call : System.Linq.Expressions.Expression * string * Type[] * System.Linq.Expressions.Expression[] -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (instance As Expression, methodName As String, typeArguments As Type(), ParamArray arguments As Expression()) As MethodCallExpression
매개 변수
- instance
- Expression
Expression 특정 메서드를 Type 검색할 속성 값입니다.
- methodName
- String
메서드의 이름입니다.
- typeArguments
- Type[]
제네릭 메서드의 Type 형식 매개 변수를 지정하는 개체의 배열입니다. methodName이 제네릭이 아닌 메서드를 지정하는 경우 이 인수는 null이어야 합니다.
- arguments
- Expression[]
메서드에 Expression 대한 인수를 나타내는 개체의 배열입니다.
반품
MethodCallExpression 속성이 같NodeType고 Call 속성 Object 이 지정된 instanceMethod인스턴스 메서드를 나타내는 속성으로 MethodInfo 설정되고 Arguments 지정된 인수로 설정된 A입니다.
예외
instance 또는 methodName .입니다 null.
이름이고 형식 매개 변수가 methodName일치하며 매개 변수 형식이 일치하는 typeArgumentsarguments 메서드가 instance없습니다. 형식 또는 해당 기본 형식입니다.
-또는-
이름이고 형식 매개 변수가 methodName일치하며 매개 변수 형식이 일치하는 typeArgumentsarguments 메서드가 두 개 이상 있습니다instance. 형식 또는 해당 기본 형식입니다.
설명
결과 Type 속성은 MethodCallExpression 로 표시된 메서드의 반환 형식과 methodName같습니다.
적용 대상
Call(Expression, MethodInfo, Expression, Expression)
두 인수를 MethodCallExpression 사용하는 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Linq::Expressions::Expression ^ instance, System::Reflection::MethodInfo ^ method, System::Linq::Expressions::Expression ^ arg0, System::Linq::Expressions::Expression ^ arg1);
public static System.Linq.Expressions.MethodCallExpression Call(System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0, System.Linq.Expressions.Expression arg1);
static member Call : System.Linq.Expressions.Expression * System.Reflection.MethodInfo * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (instance As Expression, method As MethodInfo, arg0 As Expression, arg1 As Expression) As MethodCallExpression
매개 변수
- instance
- Expression
Expression 인스턴스 호출의 인스턴스를 지정하는 형식입니다. (정적(Visual Basic에서 공유) 메서드에 대해 null을 전달합니다.
- method
- MethodInfo
MethodInfo 대상 메서드를 나타내는 값입니다.
- arg0
- Expression
Expression 첫 번째 인수를 나타내는 값입니다.
- arg1
- Expression
Expression 두 번째 인수를 나타내는 값입니다.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object 지정된 값으로 설정된 속성과 Method 속성이 있는 A입니다.
예제
다음 코드 예제에서는 두 인수가 있는 인스턴스 메서드를 호출하는 식을 만드는 방법을 보여 줍니다.
// Add the following directive to your file:
// using System.Linq.Expressions;
public class SampleClass
{
public int AddIntegers(int arg1, int arg2)
{
return arg1 + arg2;
}
}
static public void TestCall()
{
// This expression represents a call to an instance method that has two arguments.
// The first argument is an expression that creates a new object of the specified type.
Expression callExpr = Expression.Call(
Expression.New(typeof(SampleClass)),
typeof(SampleClass).GetMethod("AddIntegers", new Type[] { typeof(int), typeof(int) }),
Expression.Constant(1),
Expression.Constant(2)
);
// Print out the expression.
Console.WriteLine(callExpr.ToString());
// The following statement first creates an expression tree,
// then compiles it, and then executes it.
Console.WriteLine(Expression.Lambda<Func<int>>(callExpr).Compile()());
// This code example produces the following output:
//
// new SampleClass().AddIntegers(1, 2)
// 3
}
' Add the following directive to your file:
' Imports System.Linq.Expressions
Public Class SampleClass
Public Function AddIntegers(ByVal arg1 As Integer, ByVal arg2 As Integer) As Integer
Return (arg1 + arg2)
End Function
End Class
Public Shared Sub TestCall()
' This expression represents a call to an instance method that has two arguments.
' The first argument is an expression that creates a new object of the specified type.
Dim callExpr As Expression = Expression.Call(
Expression.[New](GetType(SampleClass)),
GetType(SampleClass).GetMethod("AddIntegers", New Type() {GetType(Integer), GetType(Integer)}),
Expression.Constant(1),
Expression.Constant(2)
)
' Print the expression.
Console.WriteLine(callExpr.ToString())
' The following statement first creates an expression tree,
' then compiles it, and then executes it.
Console.WriteLine(Expression.Lambda(Of Func(Of Integer))(callExpr).Compile()())
End Sub
' This code example produces the following output:
'
' new SampleClass().AddIntegers(1, 2)
' 3
적용 대상
Call(MethodInfo, Expression, Expression, Expression, Expression)
MethodCallExpression 4개의 인수를 사용하는 정적 메서드에 대한 호출을 나타내는 함수를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Reflection::MethodInfo ^ method, System::Linq::Expressions::Expression ^ arg0, System::Linq::Expressions::Expression ^ arg1, System::Linq::Expressions::Expression ^ arg2, System::Linq::Expressions::Expression ^ arg3);
public static System.Linq.Expressions.MethodCallExpression Call(System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0, System.Linq.Expressions.Expression arg1, System.Linq.Expressions.Expression arg2, System.Linq.Expressions.Expression arg3);
static member Call : System.Reflection.MethodInfo * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (method As MethodInfo, arg0 As Expression, arg1 As Expression, arg2 As Expression, arg3 As Expression) As MethodCallExpression
매개 변수
- method
- MethodInfo
MethodInfo 속성을 같게 Method 설정하는 A입니다.
- arg0
- Expression
Expression 첫 번째 인수를 나타내는 값입니다.
- arg1
- Expression
Expression 두 번째 인수를 나타내는 값입니다.
- arg2
- Expression
Expression 세 번째 인수를 나타내는 값입니다.
- arg3
- Expression
Expression 네 번째 인수를 나타내는 값입니다.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object 지정된 값으로 설정된 속성과 Method 속성이 있는 A입니다.
예외
method가 null입니다.
적용 대상
Call(Expression, MethodInfo, Expression[])
인수를 MethodCallExpression 사용하는 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Linq::Expressions::Expression ^ instance, System::Reflection::MethodInfo ^ method, ... cli::array <System::Linq::Expressions::Expression ^> ^ arguments);
public static System.Linq.Expressions.MethodCallExpression Call(System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo method, params System.Linq.Expressions.Expression[] arguments);
static member Call : System.Linq.Expressions.Expression * System.Reflection.MethodInfo * System.Linq.Expressions.Expression[] -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (instance As Expression, method As MethodInfo, ParamArray arguments As Expression()) As MethodCallExpression
매개 변수
- instance
- Expression
Expression 인스턴스 메서드 호출((Visual Basic의 경우) 메서드에 대한 전달null)에 대한 인스턴스를 staticShared 지정하는 값입니다.
- method
- MethodInfo
MethodInfo 속성을 같게 Method 설정하는 A입니다.
- arguments
- Expression[]
컬렉션을 채우는 데 사용할 개체의 배열 Expression 입니다 Arguments .
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object, MethodArguments 및 속성이 지정된 값으로 설정된 A입니다.
예외
method은 null입니다.
-또는-
instance
null 는 method 인스턴스 메서드를 나타냅니다.
-또는-
arguments 가 아니 null 고 해당 요소 중 하나 이상이 .입니다 null.
instance. 형식이 나타내는 method메서드의 선언 형식에 할당할 수 없습니다.
-또는-
요소 arguments 수가 나타내는 메서드 method의 매개 변수 수와 같지 않습니다.
-또는-
하나 이상의 요소를 arguments 나타내는 method메서드의 해당 매개 변수에 할당할 수 없습니다.
설명
(staticVisual Basic에서) 메서드에 대한 호출을 Shared 나타내려면 이 메서드를 null 호출할 때 매개 변수에 전달 instance 하거나 대신 호출 Call 합니다.
인스턴스 메서드를 나타내는 경우 method 해당 속성을 나타내는 Type메서드의 instance 선언 형식에 할당할 method 수 있어야 합니다.
그렇지 않은 arguments경우 null 나타내는 메서드method의 매개 변수 수와 요소 수가 같아야 합니다. 각 요소는 argumentsnull은 후의 해당 매개 변수method에 할당할 수 없어야 하며 할당할 수 있어야 합니다.
메모
해당 메서드 매개 변수가 형식 Expression인 경우에만 요소가 따옴표로 묶입니다. 따옴표는 요소가 노드에 래핑됨을 Quote 의미합니다. 결과 노드는 속성 UnaryExpression 이 Operand .의 arguments요소인 노드입니다.
결과 Arguments 속성은 MethodCallExpression 비어 있습니다(있는 경우 argumentsnull). 그렇지 않으면 동일한 요소가 arguments포함되며, 그 중 일부는 따옴표로 묶일 수 있습니다.
결과 Type 속성이 MethodCallExpression 나타내는 method메서드의 반환 형식과 같습니다.
적용 대상
Call(Expression, MethodInfo, IEnumerable<Expression>)
인수를 MethodCallExpression 사용하는 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Linq::Expressions::Expression ^ instance, System::Reflection::MethodInfo ^ method, System::Collections::Generic::IEnumerable<System::Linq::Expressions::Expression ^> ^ arguments);
public static System.Linq.Expressions.MethodCallExpression Call(System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo method, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments);
static member Call : System.Linq.Expressions.Expression * System.Reflection.MethodInfo * seq<System.Linq.Expressions.Expression> -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (instance As Expression, method As MethodInfo, arguments As IEnumerable(Of Expression)) As MethodCallExpression
매개 변수
- instance
- Expression
Expression 속성이 Object (Visual Basic의 경우nullstatic ) 메서드에 대해 전달 Shared 됨)과 같게 설정하는 것입니다.
- method
- MethodInfo
MethodInfo 속성을 같게 Method 설정하는 A입니다.
- arguments
- IEnumerable<Expression>
IEnumerable<T> 컬렉션을 채우는 데 사용할 개체가 들어 Expression 있는 개체입니다Arguments.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object, MethodArguments 및 속성이 지정된 값으로 설정된 A입니다.
예외
instance. 형식이 나타내는 method메서드의 선언 형식에 할당할 수 없습니다.
-또는-
요소 arguments 수가 나타내는 메서드 method의 매개 변수 수와 같지 않습니다.
-또는-
하나 이상의 요소를 arguments 나타내는 method메서드의 해당 매개 변수에 할당할 수 없습니다.
설명
(staticVisual Basic에서) 메서드에 대한 호출을 Shared 나타내려면 이 메서드를 null 호출할 때 매개 변수에 전달 instance 하거나 대신 호출 Call 합니다.
인스턴스 메서드를 나타내는 경우 method 해당 속성을 나타내는 Type메서드의 instance 선언 형식에 할당할 method 수 있어야 합니다.
그렇지 않은 arguments경우 null 나타내는 메서드method의 매개 변수 수와 요소 수가 같아야 합니다. 각 요소는 argumentsnull은 후의 해당 매개 변수method에 할당할 수 없어야 하며 할당할 수 있어야 합니다.
메모
해당 메서드 매개 변수가 형식 Expression인 경우에만 요소가 따옴표로 묶입니다. 따옴표는 요소가 노드에 래핑됨을 Quote 의미합니다. 결과 노드는 속성 UnaryExpression 이 Operand .의 arguments요소인 노드입니다.
결과 Arguments 속성은 MethodCallExpression 비어 있습니다(있는 경우 argumentsnull). 그렇지 않으면 동일한 요소가 arguments포함되며, 그 중 일부는 따옴표로 묶일 수 있습니다.
결과 Type 속성이 MethodCallExpression 나타내는 method메서드의 반환 형식과 같습니다.
적용 대상
Call(MethodInfo, Expression[])
인수가 MethodCallExpression 있는 (staticVisual Basic에서) 메서드에 대한 호출 Shared 을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Reflection::MethodInfo ^ method, ... cli::array <System::Linq::Expressions::Expression ^> ^ arguments);
public static System.Linq.Expressions.MethodCallExpression Call(System.Reflection.MethodInfo method, params System.Linq.Expressions.Expression[] arguments);
static member Call : System.Reflection.MethodInfo * System.Linq.Expressions.Expression[] -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (method As MethodInfo, ParamArray arguments As Expression()) As MethodCallExpression
매개 변수
- method
- MethodInfo
MethodInfo 속성을 같게 설정하는 (staticSharedVisual Basic의 경우) 메서드를 Method 나타내는 A입니다.
- arguments
- Expression[]
컬렉션을 채우는 데 사용할 개체의 배열 Expression 입니다 Arguments .
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Method 지정된 값으로 설정된 속성과 Arguments 속성이 있는 A입니다.
예외
method은 null입니다.
요소 arguments 수가 나타내는 메서드 method의 매개 변수 수와 같지 않습니다.
-또는-
하나 이상의 요소를 arguments 나타내는 method메서드의 해당 매개 변수에 할당할 수 없습니다.
설명
그렇지 않은 arguments경우 null 나타내는 메서드method의 매개 변수 수와 요소 수가 같아야 합니다. 각 요소는 argumentsnull은 후의 해당 매개 변수method에 할당할 수 없어야 하며 할당할 수 있어야 합니다.
메모
해당 메서드 매개 변수가 형식 Expression인 경우에만 요소가 따옴표로 묶입니다. 따옴표는 요소가 노드에 래핑됨을 Quote 의미합니다. 결과 노드는 속성 UnaryExpression 이 Operand .의 arguments요소인 노드입니다.
결과 Arguments 속성은 MethodCallExpression 비어 있습니다(있는 경우 argumentsnull). 그렇지 않으면 동일한 요소가 arguments포함되며, 그 중 일부는 따옴표로 묶일 수 있습니다.
결과 Type 속성이 MethodCallExpression 나타내는 method메서드의 반환 형식과 같습니다.
Object 속성은 null입니다.
적용 대상
Call(MethodInfo, Expression)
MethodCallExpression 하나의 인수를 사용하는 (staticVisual Basic에서) 메서드에 대한 호출 Shared 을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Reflection::MethodInfo ^ method, System::Linq::Expressions::Expression ^ arg0);
public static System.Linq.Expressions.MethodCallExpression Call(System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0);
static member Call : System.Reflection.MethodInfo * System.Linq.Expressions.Expression -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (method As MethodInfo, arg0 As Expression) As MethodCallExpression
매개 변수
- method
- MethodInfo
MethodInfo 속성을 같게 Method 설정하는 A입니다.
- arg0
- Expression
Expression 첫 번째 인수를 나타내는 값입니다.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object 지정된 값으로 설정된 속성과 Method 속성이 있는 A입니다.
예외
method가 null입니다.
예제
다음 예제에서는 하나의 인수를 사용하는 (staticVisual Basic에서) 메서드를 Shared 호출하는 식을 만드는 방법을 보여 줍니다.
// Add the following directive to your file:
// using System.Linq.Expressions;
public class SampleClass
{
public static int Increment(int arg1)
{
return arg1 + 1;
}
}
static public void TestCall()
{
//This expression represents a call to an instance method with one argument.
Expression callExpr = Expression.Call(
typeof(SampleClass).GetMethod("Increment"),
Expression.Constant(2)
);
// Print out the expression.
Console.WriteLine(callExpr.ToString());
// The following statement first creates an expression tree,
// then compiles it, and then executes it.
Console.WriteLine(Expression.Lambda<Func<int>>(callExpr).Compile()());
// This code example produces the following output:
//
// Increment(2)
// 3
}
' Add the following directive to your file:
' Imports System.Linq.Expressions
Public Class SampleClass
Shared Function Increment(ByVal arg1 As Integer) As Integer
Return arg1 + 1
End Function
End Class
Shared Sub TestCall()
'This expression represents a call to an instance method with one argument.
Dim callExpr As Expression = Expression.Call(
GetType(SampleClass).GetMethod("Increment"),
Expression.Constant(2))
' Print the expression.
Console.WriteLine(callExpr.ToString())
' The following statement first creates an expression tree,
' then compiles it, and then executes it.
Console.WriteLine(Expression.Lambda(Of Func(Of Integer))(callExpr).Compile()())
End Sub
' This code example produces the following output:
'
' Increment(2)
' 3
적용 대상
Call(MethodInfo, IEnumerable<Expression>)
MethodCallExpression 정적(Visual Basic에서 공유) 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Reflection::MethodInfo ^ method, System::Collections::Generic::IEnumerable<System::Linq::Expressions::Expression ^> ^ arguments);
public static System.Linq.Expressions.MethodCallExpression Call(System.Reflection.MethodInfo method, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments);
static member Call : System.Reflection.MethodInfo * seq<System.Linq.Expressions.Expression> -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (method As MethodInfo, arguments As IEnumerable(Of Expression)) As MethodCallExpression
매개 변수
- method
- MethodInfo
MethodInfo 대상 메서드를 나타내는 값입니다.
- arguments
- IEnumerable<Expression>
호출 인수를 나타내는 컬렉션 Expression 입니다.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object 지정된 값으로 설정된 속성과 Method 속성이 있는 A입니다.
적용 대상
Call(Expression, MethodInfo)
인수를 MethodCallExpression 사용하지 않는 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Linq::Expressions::Expression ^ instance, System::Reflection::MethodInfo ^ method);
public static System.Linq.Expressions.MethodCallExpression Call(System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo method);
static member Call : System.Linq.Expressions.Expression * System.Reflection.MethodInfo -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (instance As Expression, method As MethodInfo) As MethodCallExpression
매개 변수
- instance
- Expression
Expression 인스턴스 메서드 호출((Visual Basic의 경우) 메서드에 대한 전달null)에 대한 인스턴스를 staticShared 지정하는 값입니다.
- method
- MethodInfo
MethodInfo 속성을 같게 Method 설정하는 A입니다.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object 지정된 값으로 설정된 속성과 Method 속성이 있는 A입니다.
예외
instance. 형식이 나타내는 method메서드의 선언 형식에 할당할 수 없습니다.
예제
다음 코드 예제에서는 인수 없이 메서드를 호출하는 식을 만드는 방법을 보여줍니다.
// Add the following directive to your file:
// using System.Linq.Expressions;
// This expression represents a call to an instance method without arguments.
Expression callExpr = Expression.Call(
Expression.Constant("sample string"), typeof(String).GetMethod("ToUpper", new Type[] { }));
// Print out the expression.
Console.WriteLine(callExpr.ToString());
// The following statement first creates an expression tree,
// then compiles it, and then executes it.
Console.WriteLine(Expression.Lambda<Func<String>>(callExpr).Compile()());
// This code example produces the following output:
//
// "sample string".ToUpper
// SAMPLE STRING
' Add the following directive to your file:
' Imports System.Linq.Expressions
' This expression represents a call to an instance method without arguments.
Dim callExpr As Expression = Expression.Call(
Expression.Constant("sample string"), GetType(String).GetMethod("ToUpper", New Type() {}))
' Print the expression.
Console.WriteLine(callExpr.ToString())
' The following statement first creates an expression tree,
' then compiles it, and then executes it.
Console.WriteLine(Expression.Lambda(Of Func(Of String))(callExpr).Compile()())
' This code example produces the following output:
'
' "sample string".ToUpper
' SAMPLE STRING
설명
(staticVisual Basic에서) 메서드에 대한 호출을 Shared 나타내려면 이 메서드를 호출할 때 매개 변수에 null 대해 전달 instance 합니다.
인스턴스 메서드를 나타내는 경우 method 해당 속성을 나타내는 Type메서드의 instance 선언 형식에 할당할 method 수 있어야 합니다.
Arguments 결과 MethodCallExpression 속성이 비어 있습니다. 속성이 Type 나타내는 method메서드의 반환 형식과 같습니다.
적용 대상
Call(MethodInfo, Expression, Expression)
두 인수를 MethodCallExpression 사용하는 정적 메서드에 대한 호출을 나타내는 메서드를 만듭니다.
public:
static System::Linq::Expressions::MethodCallExpression ^ Call(System::Reflection::MethodInfo ^ method, System::Linq::Expressions::Expression ^ arg0, System::Linq::Expressions::Expression ^ arg1);
public static System.Linq.Expressions.MethodCallExpression Call(System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0, System.Linq.Expressions.Expression arg1);
static member Call : System.Reflection.MethodInfo * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.MethodCallExpression
Public Shared Function Call (method As MethodInfo, arg0 As Expression, arg1 As Expression) As MethodCallExpression
매개 변수
- method
- MethodInfo
MethodInfo 속성을 같게 Method 설정하는 A입니다.
- arg0
- Expression
Expression 첫 번째 인수를 나타내는 값입니다.
- arg1
- Expression
Expression 두 번째 인수를 나타내는 값입니다.
반품
MethodCallExpression 속성이 NodeType 같 Call 고 Object 지정된 값으로 설정된 속성과 Method 속성이 있는 A입니다.
예외
method가 null입니다.