Expression.Call Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
oluşturur MethodCallExpression.
Aşırı Yüklemeler
Call(MethodInfo, Expression, Expression, Expression, Expression, Expression) |
Beş bağımsız değişken alan statik bir yönteme yapılan çağrıyı temsil eden bir MethodCallExpression oluşturur. |
Call(Expression, MethodInfo, Expression, Expression, Expression) |
MethodCallExpression Üç bağımsız değişken alan bir yönteme yapılan çağrıyı temsil eden bir oluşturur. |
Call(Type, String, Type[], Expression[]) |
Uygun fabrika yöntemini çağırarak ( |
Call(MethodInfo, Expression, Expression, Expression) |
Üç bağımsız değişken alan statik bir yönteme yapılan çağrıyı temsil eden bir MethodCallExpression oluşturur. |
Call(Expression, String, Type[], Expression[]) |
MethodCallExpression Uygun fabrika yöntemini çağırarak bir yönteme yapılan çağrıyı temsil eden bir oluşturur. |
Call(Expression, MethodInfo, Expression, Expression) |
MethodCallExpression İki bağımsız değişken alan bir yönteme yapılan çağrıyı temsil eden bir oluşturur. |
Call(MethodInfo, Expression, Expression, Expression, Expression) |
MethodCallExpression Dört bağımsız değişken alan statik bir yönteme yapılan çağrıyı temsil eden bir oluşturur. |
Call(Expression, MethodInfo, Expression[]) |
MethodCallExpression Bağımsız değişkenleri alan bir yönteme yapılan çağrıyı temsil eden bir oluşturur. |
Call(Expression, MethodInfo, IEnumerable<Expression>) |
MethodCallExpression Bağımsız değişkenleri alan bir yönteme yapılan çağrıyı temsil eden bir oluşturur. |
Call(MethodInfo, Expression[]) |
MethodCallExpression Bağımsız değişkenleri olan bir ( |
Call(MethodInfo, Expression) |
Bir MethodCallExpression bağımsız değişken alan ( |
Call(MethodInfo, IEnumerable<Expression>) |
MethodCallExpression Statik (Visual Basic'te Paylaşılan) yöntemine yapılan çağrıyı temsil eden bir oluşturur. |
Call(Expression, MethodInfo) |
MethodCallExpression Bağımsız değişken içermeyen bir yönteme yapılan çağrıyı temsil eden bir oluşturur. |
Call(MethodInfo, Expression, Expression) |
MethodCallExpression İki bağımsız değişken alan statik bir yönteme yapılan çağrıyı temsil eden bir oluşturur. |
Call(MethodInfo, Expression, Expression, Expression, Expression, Expression)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
Beş bağımsız değişken alan statik bir yönteme yapılan çağrıyı temsil eden bir MethodCallExpression oluşturur.
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
Parametreler
- method
- MethodInfo
Özelliğini eşittir Method olarak ayarlamak için AMethodInfo.
- arg0
- Expression
İlk Expression bağımsız değişkeni temsil eden.
- arg1
- Expression
İkinci Expression bağımsız değişkeni temsil eden.
- arg2
- Expression
Üçüncü Expression bağımsız değişkeni temsil eden.
- arg3
- Expression
Dördüncü Expression bağımsız değişkeni temsil eden.
- arg4
- Expression
Beşinci Expression bağımsız değişkeni temsil eden.
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallObjectMethod ayarlanmış özelliğine sahip NodeType bir.
Özel durumlar
method
null değeridir.
Şunlara uygulanır
Call(Expression, MethodInfo, Expression, Expression, Expression)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression Üç bağımsız değişken alan bir yönteme yapılan çağrıyı temsil eden bir oluşturur.
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);
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
Parametreler
- instance
- Expression
Örnek Expression çağrısının örneğini belirten bir. (statik (Visual Basic'te Paylaşılan) yöntemi için null değerini geçirin).
- method
- MethodInfo
MethodInfo Hedef yöntemi temsil eden.
- arg0
- Expression
İlk Expression bağımsız değişkeni temsil eden.
- arg1
- Expression
İkinci Expression bağımsız değişkeni temsil eden.
- arg2
- Expression
Üçüncü Expression bağımsız değişkeni temsil eden.
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallObjectMethod ayarlanmış özelliğine sahip NodeType bir.
Şunlara uygulanır
Call(Type, String, Type[], Expression[])
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
Uygun fabrika yöntemini çağırarak (Shared
Visual Basic'te) yöntemine yapılan çağrıyı temsil eden bir MethodCallExpressionstatic
oluşturur.
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);
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
Parametreler
- type
- Type
Belirtilen static
(Shared
Visual Basic'te) yöntemini içeren tür.
- methodName
- String
Yöntemin adı.
- typeArguments
- Type[]
Genel yöntemin Type tür parametrelerini belirten bir nesne dizisi. methodName genel olmayan bir yöntem belirttiğinde bu bağımsız değişken null olmalıdır.
- arguments
- Expression[]
yönteminin Expression bağımsız değişkenlerini temsil eden bir nesne dizisi.
Döndürülenler
MethodCallExpression özelliğine Calleşit olanNodeType, Method özelliği MethodInfo belirtilen static
(Shared
Visual Basic'te) yöntemini temsil eden özelliğine, Arguments özelliği ise belirtilen bağımsız değişkenlere ayarlanmıştır.
Özel durumlar
type
veya methodName
şeklindedir null
.
Adı methodName
, türü parametreleri ile eşleşen ve parametre türleriyle eşleşen typeArguments
arguments
type
veya temel türleri bulunan bir yöntem yoktur.
-veya-
Türü parametreleri ile eşleşen ve parametre türleri eşleşen typeArguments
veya temel türlerinde type
arguments
bulunan, adı methodName
olan birden fazla yöntem.
Açıklamalar
Sonuçta TypeMethodCallExpression elde edilen özelliği, tarafından methodName
belirtilen yöntemin dönüş türüne eşittir. Object özelliğidirnull
.
Şunlara uygulanır
Call(MethodInfo, Expression, Expression, Expression)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
Üç bağımsız değişken alan statik bir yönteme yapılan çağrıyı temsil eden bir MethodCallExpression oluşturur.
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
Parametreler
- method
- MethodInfo
Özelliğini eşittir Method olarak ayarlamak için AMethodInfo.
- arg0
- Expression
İlk Expression bağımsız değişkeni temsil eden.
- arg1
- Expression
İkinci Expression bağımsız değişkeni temsil eden.
- arg2
- Expression
Üçüncü Expression bağımsız değişkeni temsil eden.
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallObjectMethod ayarlanmış özelliğine sahip NodeType bir.
Özel durumlar
method
null değeridir.
Şunlara uygulanır
Call(Expression, String, Type[], Expression[])
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression Uygun fabrika yöntemini çağırarak bir yönteme yapılan çağrıyı temsil eden bir oluşturur.
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);
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
Parametreler
- instance
- Expression
ExpressionType Özellik değeri belirli bir yöntem için aranacak olan.
- methodName
- String
Yöntemin adı.
- typeArguments
- Type[]
Genel yöntemin Type tür parametrelerini belirten bir nesne dizisi. methodName genel olmayan bir yöntem belirttiğinde bu bağımsız değişken null olmalıdır.
- arguments
- Expression[]
yönteminin Expression bağımsız değişkenlerini temsil eden bir nesne dizisi.
Döndürülenler
MethodCallExpression özelliğine Calleşit olan NodeType , Object değerine eşit MethodInfoinstance
Method özelliği, belirtilen örnek yöntemini temsil eden değerine ayarlanır ve Arguments belirtilen bağımsız değişkenlere ayarlanır.
Özel durumlar
instance
veya methodName
şeklindedir null
.
Türü parametreleri ile eşleşen ve parametre türleri ile eşleşen typeArguments
arguments
adı methodName
olan hiçbir yöntem içinde instance
bulunmaz. Tür veya temel türleri.
-veya-
Türü parametreleri ile eşleşen ve parametre türleri arguments
eşleşen typeArguments
adı methodName
olan birden fazla yöntem içinde instance
bulunur. Tür veya temel türleri.
Açıklamalar
Sonuçta TypeMethodCallExpression elde edilen özelliği, tarafından methodName
belirtilen yöntemin dönüş türüne eşittir.
Şunlara uygulanır
Call(Expression, MethodInfo, Expression, Expression)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression İki bağımsız değişken alan bir yönteme yapılan çağrıyı temsil eden bir oluşturur.
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);
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
Parametreler
- instance
- Expression
Örnek Expression çağrısının örneğini belirten bir. (statik (Visual Basic'te Paylaşılan) yöntemi için null değerini geçirin).
- method
- MethodInfo
MethodInfo Hedef yöntemi temsil eden.
- arg0
- Expression
İlk Expression bağımsız değişkeni temsil eden.
- arg1
- Expression
İkinci Expression bağımsız değişkeni temsil eden.
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallObjectMethod ayarlanmış özelliğine sahip NodeType bir.
Örnekler
Aşağıdaki kod örneği, iki bağımsız değişkeni olan bir örnek yöntemini çağıran bir ifadenin nasıl oluşturulacağını gösterir.
// 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
Şunlara uygulanır
Call(MethodInfo, Expression, Expression, Expression, Expression)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression Dört bağımsız değişken alan statik bir yönteme yapılan çağrıyı temsil eden bir oluşturur.
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
Parametreler
- method
- MethodInfo
Özelliğini eşittir Method olarak ayarlamak için AMethodInfo.
- arg0
- Expression
İlk Expression bağımsız değişkeni temsil eden.
- arg1
- Expression
İkinci Expression bağımsız değişkeni temsil eden.
- arg2
- Expression
Üçüncü Expression bağımsız değişkeni temsil eden.
- arg3
- Expression
Dördüncü Expression bağımsız değişkeni temsil eden.
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallObjectMethod ayarlanmış özelliğine sahip NodeType bir.
Özel durumlar
method
null değeridir.
Şunlara uygulanır
Call(Expression, MethodInfo, Expression[])
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression Bağımsız değişkenleri alan bir yönteme yapılan çağrıyı temsil eden bir oluşturur.
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);
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
Parametreler
- instance
- Expression
Örnek Expression yöntemi çağrısının örneğini belirten bir (Visual Basic'te )Shared
yöntemi için static
geçirinnull
.
- method
- MethodInfo
Özelliğini eşittir Method olarak ayarlamak için AMethodInfo.
- arguments
- Expression[]
Koleksiyonu doldurmak Arguments için kullanılacak bir nesne dizisiExpression.
Döndürülenler
MethodCallExpression ve , ArgumentsMethodve Objectözellikleri belirtilen değerlere Call ayarlanmış özelliğine sahip NodeType bir.
Özel durumlar
method
, null
değeridir.
-veya-
instance
method
ve null
bir örnek yöntemini temsil eder.
-veya-
arguments
değildir null
ve öğelerinin bir veya daha fazlası şeklindedir null
.
instance
. türü, tarafından method
temsil edilen yöntemin bildirim türüne atanamaz.
-veya-
içindeki arguments
öğe sayısı, ile method
temsil edilen yöntemin parametre sayısına eşit değildir.
-veya-
öğesinin bir veya daha fazla öğesi arguments
tarafından method
temsil edilen yöntemin ilgili parametresine atanamaz.
Açıklamalar
( Visual Basic'te) yöntemine yapılan çağrıyı static
Shared
temsil etmek için, bu yöntemi çağırdığınızda parametresini instance
geçirin null
veya bunun yerine çağrısı Call yapın.
method
Bir örnek yöntemini temsil ediyorsanız, özelliğinin Typeinstance
tarafından temsil edilen method
yöntemin bildirim türüne atanabilmesi gerekir.
null
değilsearguments
, ile temsil edilen method
yöntemin parametre sayısıyla aynı sayıda öğeye sahip olmalıdır. içindeki arguments
null
her öğe olmamalıdır ve büyük olasılıkla alıntı yaptıktan sonra öğesine karşılık gelen parametresine method
atanabilir olmalıdır.
Not
Yalnızca karşılık gelen yöntem parametresi türündeyse Expressionbir öğe tırnak içine alınacaktır. Alıntılama, öğenin bir Quote düğümde sarmalanması anlamına gelir. Elde edilen düğüm, özelliği öğesi olan Operand bir UnaryExpression düğümdürarguments
.
Arguments sonucun MethodCallExpression özelliği ise arguments
boş olurnull
. Aksi takdirde, ile aynı öğeleri arguments
içerir ve bazıları tırnak içine alınabilir.
Sonuçta TypeMethodCallExpression elde edilen özelliği ile method
temsil edilen yöntemin dönüş türüne eşittir.
Şunlara uygulanır
Call(Expression, MethodInfo, IEnumerable<Expression>)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression Bağımsız değişkenleri alan bir yönteme yapılan çağrıyı temsil eden bir oluşturur.
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);
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
Parametreler
- instance
- Expression
Expression özelliğini değerine Object eşit olarak ayarlamak için bir (Visual Basic'te bir (Shared
yöntemi için static
geçirinnull
).
- method
- MethodInfo
Özelliğini eşittir Method olarak ayarlamak için AMethodInfo.
- arguments
- IEnumerable<Expression>
IEnumerable<T> Koleksiyonu doldurmak Arguments için kullanılacak nesneleri içerenExpression.
Döndürülenler
MethodCallExpression ve , ArgumentsMethodve Objectözellikleri belirtilen değerlere Call ayarlanmış özelliğine sahip NodeType bir.
Özel durumlar
method
, null
değeridir.
-veya-
instance
method
ve null
bir örnek yöntemini temsil eder.
instance
. türü, tarafından method
temsil edilen yöntemin bildirim türüne atanamaz.
-veya-
içindeki arguments
öğe sayısı, ile method
temsil edilen yöntemin parametre sayısına eşit değildir.
-veya-
öğesinin bir veya daha fazla öğesi arguments
tarafından method
temsil edilen yöntemin ilgili parametresine atanamaz.
Açıklamalar
( Visual Basic'te) yöntemine yapılan çağrıyı static
Shared
temsil etmek için, bu yöntemi çağırdığınızda parametresini instance
geçirin null
veya bunun yerine çağrısı Call yapın.
method
Bir örnek yöntemini temsil ediyorsanız, özelliğinin Typeinstance
tarafından temsil edilen method
yöntemin bildirim türüne atanabilmesi gerekir.
null
değilsearguments
, ile temsil edilen method
yöntemin parametre sayısıyla aynı sayıda öğeye sahip olmalıdır. içindeki arguments
null
her öğe olmamalıdır ve büyük olasılıkla alıntı yaptıktan sonra öğesine karşılık gelen parametresine method
atanabilir olmalıdır.
Not
Yalnızca karşılık gelen yöntem parametresi türündeyse Expressionbir öğe tırnak içine alınacaktır. Alıntılama, öğenin bir Quote düğümde sarmalanması anlamına gelir. Elde edilen düğüm, özelliği öğesi olan Operand bir UnaryExpression düğümdürarguments
.
Arguments sonucun MethodCallExpression özelliği ise arguments
boş olurnull
. Aksi takdirde, ile aynı öğeleri arguments
içerir ve bazıları tırnak içine alınabilir.
Sonuçta TypeMethodCallExpression elde edilen özelliği ile method
temsil edilen yöntemin dönüş türüne eşittir.
Şunlara uygulanır
Call(MethodInfo, Expression[])
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression Bağımsız değişkenleri olan bir (Shared
Visual Basic'te) yöntemine yapılan çağrıyı temsil eden bir static
oluşturur.
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);
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
Parametreler
- method
- MethodInfo
MethodInfo Özelliğinin eşit olarak ayarlanacağı Method ( static
Shared
Visual Basic'te) yöntemini temsil eden bir.
- arguments
- Expression[]
Koleksiyonu doldurmak Arguments için kullanılacak bir nesne dizisiExpression.
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallMethodArguments ayarlanmış özelliğine sahip NodeType bir.
Özel durumlar
method
, null
değeridir.
içindeki arguments
öğe sayısı, ile method
temsil edilen yöntemin parametre sayısına eşit değildir.
-veya-
öğesinin bir veya daha fazla öğesi arguments
tarafından method
temsil edilen yöntemin ilgili parametresine atanamaz.
Açıklamalar
null
değilsearguments
, ile temsil edilen method
yöntemin parametre sayısıyla aynı sayıda öğeye sahip olmalıdır. içindeki arguments
null
her öğe olmamalıdır ve büyük olasılıkla alıntı yaptıktan sonra öğesine karşılık gelen parametresine method
atanabilir olmalıdır.
Not
Yalnızca karşılık gelen yöntem parametresi türündeyse Expressionbir öğe tırnak içine alınacaktır. Alıntılama, öğenin bir Quote düğümde sarmalanması anlamına gelir. Elde edilen düğüm, özelliği öğesi olan Operand bir UnaryExpression düğümdürarguments
.
Arguments sonucun MethodCallExpression özelliği ise arguments
boş olurnull
. Aksi takdirde, ile aynı öğeleri arguments
içerir ve bazıları tırnak içine alınabilir.
Sonuçta TypeMethodCallExpression elde edilen özelliği ile method
temsil edilen yöntemin dönüş türüne eşittir. Object özelliğidirnull
.
Şunlara uygulanır
Call(MethodInfo, Expression)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
Bir MethodCallExpression bağımsız değişken alan ( static
Shared
Visual Basic'te) yöntemine yapılan çağrıyı temsil eden bir oluşturur.
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
Parametreler
- method
- MethodInfo
Özelliğini eşittir Method olarak ayarlamak için AMethodInfo.
- arg0
- Expression
İlk Expression bağımsız değişkeni temsil eden.
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallObjectMethod ayarlanmış özelliğine sahip NodeType bir.
Özel durumlar
method
null değeridir.
Örnekler
Aşağıdaki örnekte, bir bağımsız değişken alan (Shared
Visual Basic'te) yöntemini çağıran bir static
ifadenin nasıl oluşturulacağı gösterilmektedir.
// 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
Şunlara uygulanır
Call(MethodInfo, IEnumerable<Expression>)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression Statik (Visual Basic'te Paylaşılan) yöntemine yapılan çağrıyı temsil eden bir oluşturur.
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);
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
Parametreler
- method
- MethodInfo
MethodInfo Hedef yöntemi temsil eden.
- arguments
- IEnumerable<Expression>
Çağrı bağımsız değişkenlerini temsil eden bir koleksiyonu Expression .
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallObjectMethod ayarlanmış özelliğine sahip NodeType bir.
Şunlara uygulanır
Call(Expression, MethodInfo)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression Bağımsız değişken içermeyen bir yönteme yapılan çağrıyı temsil eden bir oluşturur.
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);
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
Parametreler
- instance
- Expression
Örnek Expression yöntemi çağrısının örneğini belirten bir (Visual Basic'te )Shared
yöntemi için static
geçirinnull
.
- method
- MethodInfo
Özelliğini eşittir Method olarak ayarlamak için AMethodInfo.
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallObjectMethod ayarlanmış özelliğine sahip NodeType bir.
Özel durumlar
method
, null
değeridir.
-veya-
instance
method
ve null
bir örnek yöntemini temsil eder.
instance
. türü, tarafından method
temsil edilen yöntemin bildirim türüne atanamaz.
Örnekler
Aşağıdaki kod örneği, bağımsız değişkenler olmadan bir yöntemi çağıran bir ifadenin nasıl oluşturulacağını gösterir.
// 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
Açıklamalar
( Visual Basic'te) yöntemine yapılan çağrıyı static
Shared
temsil etmek için, bu yöntemi çağırdığınızda parametresi için instance
geçirinnull
.
method
Bir örnek yöntemini temsil ediyorsanız, özelliğinin Typeinstance
tarafından temsil edilen method
yöntemin bildirim türüne atanabilmesi gerekir.
Sonuçta ArgumentsMethodCallExpression elde edilen özelliği boş. Type özelliği ile temsil edilen method
yöntemin dönüş türüne eşittir.
Şunlara uygulanır
Call(MethodInfo, Expression, Expression)
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
- Kaynak:
- MethodCallExpression.cs
MethodCallExpression İki bağımsız değişken alan statik bir yönteme yapılan çağrıyı temsil eden bir oluşturur.
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
Parametreler
- method
- MethodInfo
Özelliğini eşittir Method olarak ayarlamak için AMethodInfo.
- arg0
- Expression
İlk Expression bağımsız değişkeni temsil eden.
- arg1
- Expression
İkinci Expression bağımsız değişkeni temsil eden.
Döndürülenler
MethodCallExpression ve ve özellikleri belirtilen değerlere CallObjectMethod ayarlanmış özelliğine sahip NodeType bir.
Özel durumlar
method
null değeridir.
Şunlara uygulanır
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin