Show / Hide Table of Contents

Class FieldExtensions

Extends FieldInfo class.

Inheritance
object
FieldExtensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext.Reflection
Assembly: DotNext.dll
Syntax
public static class FieldExtensions

Methods

View Source

FromField(object, FieldInfo)

Returns a reference to the field.

Declaration
public static Variant FromField(object owner, FieldInfo field)
Parameters
Type Name Description
object owner

The object which contains a field.

FieldInfo field

The field reference.

Returns
Type Description
Variant

Location of the field value.

Exceptions
Type Condition
ArgumentNullException

owner or field is null.

ArgumentException

field is static.

View Source

GetValue<T>(FieldInfo, object)

Gets value of the field.

Declaration
public static ref T GetValue<T>(this FieldInfo field, object owner) where T : notnull
Parameters
Type Name Description
FieldInfo field
object owner

The field owner.

Returns
Type Description
T

The field location.

Type Parameters
Name Description
T

The type of the field.

  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾