PropertyBuilder.GetSetMethod(Boolean) 方法

定义

返回此属性的 set 访问器。

public:
 override System::Reflection::MethodInfo ^ GetSetMethod(bool nonPublic);
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,如下表所示。

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

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

nullnonPublic 为 true,但属性为只读。

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

注解

若要获取属性的资源库,请使用 Type.GetType 或 Assembly.GetType 对属性的父类型进行反射,从类型中检索 Reflection 属性对象,然后调用 PropertyInfo.GetSetMethod。

适用于