M_Cyjb_Reflection_PowerBinder_BindToField - CYJB/Cyjb GitHub Wiki

PowerBinder.BindToField 方法

基于指定的判据,从给定的字段集中选择一个字段。

Namespace: Cyjb.Reflection
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6

语法

C#

public override FieldInfo BindToField(
	BindingFlags bindingAttr,
	FieldInfo[] match,
	Object value,
	CultureInfo? culture
)

参数

 

bindingAttr
Type: System.Reflection.BindingFlags
BindingFlags 值的按位组合。
match
Type: System.Reflection.FieldInfo[]
用于匹配的候选字段集。PowerBinder 的实现会更改此数组的顺序。
value
Type: System.Object
用于定位匹配字段的字段值。
culture
Type: System.Globalization.CultureInfo
一个 CultureInfo 实例,用于在强制类型的联编程序实现中控制数据类型强制。

返回值

Type: FieldInfo
匹配的字段。

Exceptions

 

异常 条件
ArgumentNullException matchnull
ArgumentException match 为空数组。
ArgumentException match 中包含为 null 的元素。
AmbiguousMatchException match 包含多个与 value 匹配程度相同的字段。
MissingFieldException bindingAttr 包含 SetField,且 match 不包含任何可接受 value 的字段。

参见

Reference

PowerBinder 类
Cyjb.Reflection 命名空间

⚠️ **GitHub.com Fallback** ⚠️