XamlMemberInvoker.GetValue(Object) Method

Definition

Gets a value of the relevant property from an instance.

C#
public virtual object GetValue(object instance);

Parameters

instance
Object

An instance of the owner type for the member.

Returns

The requested property value.

Exceptions

instance is null.

Invoked this method on a XamlMemberInvoker that is based on an unknown XamlMember.

-or-

Invoked this method on a write-only member.

-or-

UnderlyingGetter is null.

Notes to Inheritors

The base implementation includes a call to the internal helper ThrowIfUnknown. This helper always throws for cases where a XamlMemberInvoker is based on an unknown XamlMember, which includes cases where the UnderlyingMember of the XamlMember is null.

The base implementation throws if UnderlyingGetter is null.

For static properties (IsStatic is true per UnderlyingGetter) the default implementation calls Invoke(Object, Object[]) on UnderlyingGetter passing null as the first parameter and packaged instance in the second. For non-static properties, it calls Invoke(Object, Object[]) and forwards the instance as the first parameter and an empty package as the second parameter.

Applies to

Produkt Verzie
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10