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,如下表所示。

條件
MethodInfo 物件,表示這個屬性的 Set 方法。 set 存取子為公用。

nonPublic 為 true,可傳回非公用方法。

nullnonPublic 為 true,但屬性為唯讀。

nonPublic 為 false,且 set 存取子為非公用。

備註

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

適用於