PropertyBuilder.GetGetMethod(Boolean) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回该属性的公共和非公共 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。
返回
如果 nonPublic 为 true,则返回表示该属性的 get 访问器的 MethodInfo 对象。 如果 nonPublic 为 false 且 get 访问器是非公共的,或者如果 nonPublic 为 true 但不存在 get 访问器,则返回 null。
注解
若要获取属性的 getter,请使用 Type.GetType 或 Assembly.GetType 对属性的父类型进行反思,从类型中检索 Reflection 属性对象,然后调用 PropertyInfo.GetGetMethod。