Upraviť

Zdieľať cez


Expression.Bind Method

Definition

Creates a MemberAssignment that represents the initialization of a member.

Overloads

Bind(MemberInfo, Expression)

Creates a MemberAssignment that represents the initialization of a field or property.

Bind(MethodInfo, Expression)

Creates a MemberAssignment that represents the initialization of a member by using a property accessor method.

Bind(MemberInfo, Expression)

Source:
MemberAssignment.cs
Source:
MemberAssignment.cs
Source:
MemberAssignment.cs

Creates a MemberAssignment that represents the initialization of a field or property.

public:
 static System::Linq::Expressions::MemberAssignment ^ Bind(System::Reflection::MemberInfo ^ member, System::Linq::Expressions::Expression ^ expression);
public static System.Linq.Expressions.MemberAssignment Bind (System.Reflection.MemberInfo member, System.Linq.Expressions.Expression expression);
static member Bind : System.Reflection.MemberInfo * System.Linq.Expressions.Expression -> System.Linq.Expressions.MemberAssignment
Public Shared Function Bind (member As MemberInfo, expression As Expression) As MemberAssignment

Parameters

member
MemberInfo

A MemberInfo to set the Member property equal to.

expression
Expression

An Expression to set the Expression property equal to.

Returns

A MemberAssignment that has BindingType equal to Assignment and the Member and Expression properties set to the specified values.

Exceptions

member or expression is null.

member does not represent a field or property.

-or-

The property represented by member does not have a set accessor.

-or-

expression.Type is not assignable to the type of the field or property that member represents.

Remarks

The Type property of expression must be assignable to the type represented by the FieldType or PropertyType property of member.

Applies to

Bind(MethodInfo, Expression)

Source:
MemberAssignment.cs
Source:
MemberAssignment.cs
Source:
MemberAssignment.cs

Creates a MemberAssignment that represents the initialization of a member by using a property accessor method.

public:
 static System::Linq::Expressions::MemberAssignment ^ Bind(System::Reflection::MethodInfo ^ propertyAccessor, System::Linq::Expressions::Expression ^ expression);
public static System.Linq.Expressions.MemberAssignment Bind (System.Reflection.MethodInfo propertyAccessor, System.Linq.Expressions.Expression expression);
static member Bind : System.Reflection.MethodInfo * System.Linq.Expressions.Expression -> System.Linq.Expressions.MemberAssignment
Public Shared Function Bind (propertyAccessor As MethodInfo, expression As Expression) As MemberAssignment

Parameters

propertyAccessor
MethodInfo

A MethodInfo that represents a property accessor method.

expression
Expression

An Expression to set the Expression property equal to.

Returns

A MemberAssignment that has the BindingType property equal to Assignment, the Member property set to the PropertyInfo that represents the property accessed in propertyAccessor, and the Expression property set to expression.

Exceptions

propertyAccessor or expression is null.

propertyAccessor does not represent a property accessor method.

-or-

The property accessed by propertyAccessor does not have a set accessor.

-or-

expression.Type is not assignable to the type of the field or property that member represents.

Remarks

The Type property of expression must be assignable to the type represented by the PropertyType property of the property accessed in propertyAccessor.

Applies to