Expression.Property 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.
Bir MemberExpression özelliğe erişimi temsil eden bir oluşturur.
Aşırı Yüklemeler
| Name | Description |
|---|---|
| Property(Expression, String, Expression[]) |
IndexExpression Dizine alınan özelliğe erişimi temsil eden bir oluşturur. |
| Property(Expression, PropertyInfo, Expression[]) |
IndexExpression Dizine alınan özelliğe erişimi temsil eden bir oluşturur. |
| Property(Expression, PropertyInfo, IEnumerable<Expression>) |
IndexExpression Dizine alınan özelliğe erişimi temsil eden bir oluşturur. |
| Property(Expression, Type, String) |
MemberExpression Bir özelliğe erişim oluşturur. |
| Property(Expression, PropertyInfo) |
Bir MemberExpression özelliğe erişimi temsil eden bir oluşturur. |
| Property(Expression, MethodInfo) |
Özellik MemberExpression erişimci yöntemi kullanarak bir özelliğe erişimi temsil eden bir oluşturur. |
| Property(Expression, String) |
Bir MemberExpression özelliğe erişimi temsil eden bir oluşturur. |
Property(Expression, String, Expression[])
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
IndexExpression Dizine alınan özelliğe erişimi temsil eden bir oluşturur.
public:
static System::Linq::Expressions::IndexExpression ^ Property(System::Linq::Expressions::Expression ^ instance, System::String ^ propertyName, ... cli::array <System::Linq::Expressions::Expression ^> ^ arguments);
public static System.Linq.Expressions.IndexExpression Property(System.Linq.Expressions.Expression instance, string propertyName, params System.Linq.Expressions.Expression[] arguments);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed.")]
public static System.Linq.Expressions.IndexExpression Property(System.Linq.Expressions.Expression instance, string propertyName, params System.Linq.Expressions.Expression[]? arguments);
public static System.Linq.Expressions.IndexExpression Property(System.Linq.Expressions.Expression instance, string propertyName, params System.Linq.Expressions.Expression[]? arguments);
static member Property : System.Linq.Expressions.Expression * string * System.Linq.Expressions.Expression[] -> System.Linq.Expressions.IndexExpression
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed.")>]
static member Property : System.Linq.Expressions.Expression * string * System.Linq.Expressions.Expression[] -> System.Linq.Expressions.IndexExpression
Public Shared Function Property (instance As Expression, propertyName As String, ParamArray arguments As Expression()) As IndexExpression
Parametreler
- instance
- Expression
Özelliğin ait olduğu nesne. Özellik statik/paylaşılan ise null olmalıdır.
- propertyName
- String
Dizin oluşturucunun adı.
- arguments
- Expression[]
Özelliği dizine Expression almak için kullanılan bir nesne dizisi.
Döndürülenler
Oluşturulan IndexExpression.
- Öznitelikler
Şunlara uygulanır
Property(Expression, PropertyInfo, Expression[])
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
IndexExpression Dizine alınan özelliğe erişimi temsil eden bir oluşturur.
public:
static System::Linq::Expressions::IndexExpression ^ Property(System::Linq::Expressions::Expression ^ instance, System::Reflection::PropertyInfo ^ indexer, ... cli::array <System::Linq::Expressions::Expression ^> ^ arguments);
public static System.Linq.Expressions.IndexExpression Property(System.Linq.Expressions.Expression instance, System.Reflection.PropertyInfo indexer, params System.Linq.Expressions.Expression[] arguments);
public static System.Linq.Expressions.IndexExpression Property(System.Linq.Expressions.Expression? instance, System.Reflection.PropertyInfo indexer, params System.Linq.Expressions.Expression[]? arguments);
static member Property : System.Linq.Expressions.Expression * System.Reflection.PropertyInfo * System.Linq.Expressions.Expression[] -> System.Linq.Expressions.IndexExpression
Public Shared Function Property (instance As Expression, indexer As PropertyInfo, ParamArray arguments As Expression()) As IndexExpression
Parametreler
- instance
- Expression
Özelliğin ait olduğu nesne. Özellik statik/paylaşılan ise null olmalıdır.
- indexer
- PropertyInfo
Dizine PropertyInfo almak için özelliğini temsil eden.
- arguments
- Expression[]
Özelliği dizine Expression almak için kullanılan bir nesne dizisi.
Döndürülenler
Oluşturulan IndexExpression.
Şunlara uygulanır
Property(Expression, PropertyInfo, IEnumerable<Expression>)
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
- Kaynak:
- IndexExpression.cs
IndexExpression Dizine alınan özelliğe erişimi temsil eden bir oluşturur.
public:
static System::Linq::Expressions::IndexExpression ^ Property(System::Linq::Expressions::Expression ^ instance, System::Reflection::PropertyInfo ^ indexer, System::Collections::Generic::IEnumerable<System::Linq::Expressions::Expression ^> ^ arguments);
public static System.Linq.Expressions.IndexExpression Property(System.Linq.Expressions.Expression instance, System.Reflection.PropertyInfo indexer, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments);
public static System.Linq.Expressions.IndexExpression Property(System.Linq.Expressions.Expression? instance, System.Reflection.PropertyInfo indexer, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression>? arguments);
static member Property : System.Linq.Expressions.Expression * System.Reflection.PropertyInfo * seq<System.Linq.Expressions.Expression> -> System.Linq.Expressions.IndexExpression
Public Shared Function Property (instance As Expression, indexer As PropertyInfo, arguments As IEnumerable(Of Expression)) As IndexExpression
Parametreler
- instance
- Expression
Özelliğin ait olduğu nesne. Özellik statik/paylaşılan ise null olmalıdır.
- indexer
- PropertyInfo
Dizine PropertyInfo almak için özelliğini temsil eden.
- arguments
- IEnumerable<Expression>
IEnumerable<T> Özelliği dizine Expression almak için kullanılan nesnelerden biri.
Döndürülenler
Oluşturulan IndexExpression.
Şunlara uygulanır
Property(Expression, Type, String)
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
MemberExpression Bir özelliğe erişim oluşturur.
public:
static System::Linq::Expressions::MemberExpression ^ Property(System::Linq::Expressions::Expression ^ expression, Type ^ type, System::String ^ propertyName);
public static System.Linq.Expressions.MemberExpression Property(System.Linq.Expressions.Expression expression, Type type, string propertyName);
public static System.Linq.Expressions.MemberExpression Property(System.Linq.Expressions.Expression? expression, Type type, string propertyName);
static member Property : System.Linq.Expressions.Expression * Type * string -> System.Linq.Expressions.MemberExpression
Public Shared Function Property (expression As Expression, type As Type, propertyName As String) As MemberExpression
Parametreler
- expression
- Expression
özelliğinin içeren nesnesi. Bu, statik özellikler için null olabilir.
- propertyName
- String
Erişilecek özellik.
Döndürülenler
Oluşturulan MemberExpression.
Şunlara uygulanır
Property(Expression, PropertyInfo)
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
Bir MemberExpression özelliğe erişimi temsil eden bir oluşturur.
public:
static System::Linq::Expressions::MemberExpression ^ Property(System::Linq::Expressions::Expression ^ expression, System::Reflection::PropertyInfo ^ property);
public static System.Linq.Expressions.MemberExpression Property(System.Linq.Expressions.Expression expression, System.Reflection.PropertyInfo property);
public static System.Linq.Expressions.MemberExpression Property(System.Linq.Expressions.Expression? expression, System.Reflection.PropertyInfo property);
static member Property : System.Linq.Expressions.Expression * System.Reflection.PropertyInfo -> System.Linq.Expressions.MemberExpression
Public Shared Function Property (expression As Expression, property As PropertyInfo) As MemberExpression
Parametreler
- expression
- Expression
Özelliğinin Expression değerine eşit olarak ayarlanması için birExpression. Bu, statik özellikler için null olabilir.
- property
- PropertyInfo
PropertyInfo özelliğini eşittir Member olarak ayarlamak için.
Döndürülenler
MemberExpression özelliğine MemberAccessNodeType eşit ve ve MemberExpression özellikleri belirtilen değerlere ayarlanmış bir.
Özel durumlar
property, null'e eşittir.
-veya-
Temsil eden property özellik değildir static (Shared Visual Basic'te) ve expression şeklindedir null.
expression. Tür, temsil eden özelliğin property bildirim türüne atanamaz.
Açıklamalar
Sonuçta TypeMemberExpression elde edilen özelliğinin özelliği, özelliğine PropertyTypeMembereşittir.
ile property temsil edilen özellik ( staticShared Visual Basic'te) expression olabilirnull.
Şunlara uygulanır
Property(Expression, MethodInfo)
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
Özellik MemberExpression erişimci yöntemi kullanarak bir özelliğe erişimi temsil eden bir oluşturur.
public:
static System::Linq::Expressions::MemberExpression ^ Property(System::Linq::Expressions::Expression ^ expression, System::Reflection::MethodInfo ^ propertyAccessor);
public static System.Linq.Expressions.MemberExpression Property(System.Linq.Expressions.Expression expression, System.Reflection.MethodInfo propertyAccessor);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Property metadata or other accessor may be trimmed.")]
public static System.Linq.Expressions.MemberExpression Property(System.Linq.Expressions.Expression? expression, System.Reflection.MethodInfo propertyAccessor);
public static System.Linq.Expressions.MemberExpression Property(System.Linq.Expressions.Expression? expression, System.Reflection.MethodInfo propertyAccessor);
static member Property : System.Linq.Expressions.Expression * System.Reflection.MethodInfo -> System.Linq.Expressions.MemberExpression
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Property metadata or other accessor may be trimmed.")>]
static member Property : System.Linq.Expressions.Expression * System.Reflection.MethodInfo -> System.Linq.Expressions.MemberExpression
Public Shared Function Property (expression As Expression, propertyAccessor As MethodInfo) As MemberExpression
Parametreler
- expression
- Expression
Özelliğinin Expression değerine eşit olarak ayarlanması için birExpression. Bu, statik özellikler için null olabilir.
- propertyAccessor
- MethodInfo
MethodInfo Bir özellik erişimci yöntemini temsil eden.
Döndürülenler
özelliğine eşit olan, Expression özelliği olarak Memberexpression, özelliği ise içinde erişilen özelliği temsil eden değerine ayarlanmıştır PropertyInfopropertyAccessor.NodeTypeMemberAccessMemberExpression
- Öznitelikler
Özel durumlar
propertyAccessor, null'e eşittir.
-veya-
Temsil eden propertyAccessor yöntem değildir static (Shared Visual Basic'te) ve expression şeklindedir null.
expression. türü, tarafından propertyAccessortemsil edilen yöntemin bildirim türüne atanamaz.
-veya-
Temsil eden propertyAccessor yöntem bir özellik erişimcisi yöntemi değildir.
Açıklamalar
Sonuçta TypeMemberExpression elde edilen özelliğinin özelliği, özelliğine PropertyTypeMembereşittir.
tarafından propertyAccessor temsil edilen yöntem ( staticShared Visual Basic'te) expression ise olabilirnull.
Şunlara uygulanır
Property(Expression, String)
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
- Kaynak:
- MemberExpression.cs
Bir MemberExpression özelliğe erişimi temsil eden bir oluşturur.
public:
static System::Linq::Expressions::MemberExpression ^ Property(System::Linq::Expressions::Expression ^ expression, System::String ^ propertyName);
public static System.Linq.Expressions.MemberExpression Property(System.Linq.Expressions.Expression expression, string propertyName);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed.")]
public static System.Linq.Expressions.MemberExpression Property(System.Linq.Expressions.Expression expression, string propertyName);
static member Property : System.Linq.Expressions.Expression * string -> System.Linq.Expressions.MemberExpression
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed.")>]
static member Property : System.Linq.Expressions.Expression * string -> System.Linq.Expressions.MemberExpression
Public Shared Function Property (expression As Expression, propertyName As String) As MemberExpression
Parametreler
- expression
- Expression
Expression
Type adlı propertyNamebir özellik içeren bir. Bu, statik özellikler için olabilir null .
- propertyName
- String
Erişilecek özelliğin adı.
Döndürülenler
özelliğine MemberAccesseşit olanNodeType, Expression özelliği olarakexpressionMember, özelliği ise tarafından propertyNamebelirtilen özelliği temsil eden özelliği olarak ayarlanmıştırPropertyInfo.MemberExpression
- Öznitelikler
Özel durumlar
expression veya propertyName şeklindedir null.
içinde expressionadlı propertyName bir özellik tanımlanmadı. Tür veya temel türleri.
Örnekler
Aşağıdaki örnekte bir özelliğe erişimi temsil eden bir ifadenin nasıl oluşturulacağı gösterilmektedir.
// Add the following directive to your file:
// using System.Linq.Expressions;
class TestPropertyClass
{
public int sample {get; set;}
}
static void TestProperty()
{
TestPropertyClass obj = new TestPropertyClass();
obj.sample = 40;
// This expression represents accessing a property.
// For static fields, the first parameter must be null.
Expression propertyExpr = Expression.Property(
Expression.Constant(obj),
"sample"
);
// The following statement first creates an expression tree,
// then compiles it, and then runs it.
Console.WriteLine(Expression.Lambda<Func<int>>(propertyExpr).Compile()());
}
// This code example produces the following output:
//
// 40
' Add the following directive to your file:
' Imports System.Linq.Expressions
Class TestPropertyClass
Public Property Sample As Integer
End Class
Sub TestProperty()
Dim obj As New TestPropertyClass()
obj.Sample = 40
' This expression represents accessing a property.
' For static properties, the first parameter must be Nothing.
Dim propertyExpr As Expression = Expression.Property(
Expression.Constant(obj),
"sample"
)
' The following statement first creates an expression tree,
' then compiles it, and then runs it.
Console.WriteLine(Expression.Lambda(Of Func(Of Integer))(propertyExpr).Compile()())
End Sub
' This code example produces the following output:
'
' 40
Açıklamalar
Sonuçta TypeMemberExpression elde edilen özelliği, tarafından propertyNamebelirtilen özelliği PropertyInfo temsil eden özelliğinin özelliğine eşittirPropertyType.
Bu yöntem arar expression. adına propertyNamesahip bir özellik için türü ve temel türleri. Ortak özelliklere genel olmayan özelliklere göre tercih edilir. Eşleşen bir özellik bulunursa, bu yöntem ile bu özelliği temsil eden öğesini iletir expressionPropertyInfoProperty.