Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: T GetFieldValue<T>(this object, string)

  • Declared in: RT.Util.Ut

Declaration

public static T GetFieldValue<T>(
    this object instance,
    string fieldName
)

Summary

Searches the specified object’s type for a field of the specified name and returns that field’s value.

Generic type parameters

T Expected type of the field.

Parameters

this objectinstance Instance from which to retrieve the field value.
stringfieldName Name of the field to return the value of.

Returns

The value of the field.

Exceptions

  • System.InvalidOperationException
    • The field is of a different type than specified.
    • There is no field with the specified name.

Remarks

This method is intended to be used only for debugging. Do not rely on it in production code.