PropertyBuilder.GetGetMethod(Boolean) 方法

定义

返回此属性的公共和非公共 get 访问器。

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

参数

nonPublic
Boolean

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

返回

一个 MethodInfo 对象,表示此属性的 get 访问器(如果 nonPublictrue)。 返回 null is nonPublicfalse 和 get 访问器是非公共访问器,或者如果 nonPublic 不存在 true 但不存在 get 访问器。

注解

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

适用于