PropertyBuilder.GetSetMethod(Boolean) 方法

定义

返回此属性的 set 访问器。

public:
 override System::Reflection::MethodInfo ^ GetSetMethod(bool nonPublic);
public override System.Reflection.MethodInfo GetSetMethod(bool nonPublic);
override this.GetSetMethod : bool -> System.Reflection.MethodInfo
Public Overrides Function GetSetMethod (nonPublic As Boolean) As MethodInfo

参数

nonPublic
Boolean

指示是否应返回访问器(如果它是非公共访问器)。 true 如果要包括非公共方法,则为否则,为 false.

返回

属性 Set 的方法,或 null如下表所示。

条件
一个 MethodInfo 表示此属性的 Set 方法的对象。 set 访问器是公共的。

nonPublic 为 true,可以返回非公共方法。

nonPublic 为 true,但属性为只读。

nonPublic 为 false,set 访问器为非公共访问器。

注解

若要获取属性的 setter,请使用 Type.GetType 或 Assembly.GetType 反映属性的父类型,从该类型中检索 Reflection 属性对象,并调用 PropertyInfo.GetSetMethod。

适用于