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)。 如果 nonPublicnull,並且 get 存取子為非公用,或者,如果 nonPublicfalse,但 get 存取子不存在,則傳回 true

備註

若要取得屬性的 getter,請使用 Type.GetType 或 Assembly.GetType 來反映屬性的父類型、從類型擷取 Reflection 屬性對象,然後呼叫 PropertyInfo.GetGetMethod。

適用於