PropertyBuilder.GetValue 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
藉由呼叫 getter 取得屬性值。
多載
| GetValue(Object, Object[]) |
藉由呼叫屬性的 getter 方法,取得索引屬性的值。 |
| GetValue(Object, BindingFlags, Binder, Object[], CultureInfo) |
取得屬性值,其具有指定繫結、索引和 |
GetValue(Object, Object[])
藉由呼叫屬性的 getter 方法,取得索引屬性的值。
public:
override System::Object ^ GetValue(System::Object ^ obj, cli::array <System::Object ^> ^ index);
public override object GetValue(object? obj, object?[]? index);
public override object GetValue(object obj, object[] index);
override this.GetValue : obj * obj[] -> obj
Public Overrides Function GetValue (obj As Object, index As Object()) As Object
參數
- obj
- Object
其屬性值將被傳回的物件。
- index
- Object[]
索引屬性的選擇性索引值。 非索引屬性的這個值應為 null。
傳回
指定的索引屬性值。
例外狀況
不支援這個方法。
備註
若要取得屬性的值,請使用 Type.GetType 或 Assembly.GetType 反映屬性的父類型、從類型擷取 Reflection 屬性物件,然後呼叫 PropertyInfo.GetValue。
適用於
GetValue(Object, BindingFlags, Binder, Object[], CultureInfo)
取得屬性值,其具有指定繫結、索引和 CultureInfo。
public:
override System::Object ^ GetValue(System::Object ^ obj, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, cli::array <System::Object ^> ^ index, System::Globalization::CultureInfo ^ culture);
public override object GetValue(object? obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? index, System.Globalization.CultureInfo? culture);
public override object GetValue(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] index, System.Globalization.CultureInfo culture);
override this.GetValue : obj * System.Reflection.BindingFlags * System.Reflection.Binder * obj[] * System.Globalization.CultureInfo -> obj
Public Overrides Function GetValue (obj As Object, invokeAttr As BindingFlags, binder As Binder, index As Object(), culture As CultureInfo) As Object
參數
- obj
- Object
其屬性值將被傳回的物件。
- invokeAttr
- BindingFlags
引動過程屬性。 這必須是 BindingFlags 中的位元旗標:InvokeMethod、CreateInstance、Static、GetField、SetField、GetProperty 或 SetProperty。 您必須指定適當的引動過程屬性。 如果將要叫用靜態成員,則必須設定 Static 的 BindingFlags 旗標。
- binder
- Binder
使用反映來啟用繫結、強制引數的類型、成員的引動過程,和擷取 MemberInfo 物件的物件。 如果 binder 為 null,則會使用預設繫結器。
- index
- Object[]
索引屬性的選擇性索引值。 非索引屬性的這個值應為 null。
- culture
- CultureInfo
CultureInfo 物件,表示資源將要為其當地語系化的文化特性。 請注意,如果並未為這個文化特性將資源當地語系化,則將在搜尋相符項目時持續呼叫 CultureInfo.Parent 方法。 如果這個值為 null,則 CultureInfo 是取自 CultureInfo.CurrentUICulture 屬性。
傳回
obj 的屬性值。
例外狀況
不支援這個方法。
備註
若要取得屬性的值,請使用 Type.GetType 或 Assembly.GetType 來反映屬性的父類型、從類型擷取 Reflection 屬性對象,然後呼叫 PropertyInfo.GetValue。