Table of Contents

Class FieldInfo

Namespace
Yarhl.IO.Serialization
Assembly
Yarhl.dll

Information of a field member of a type.

public record FieldInfo : IEquatable<FieldInfo>
Inheritance
FieldInfo
Implements
Inherited Members

Constructors

FieldInfo(string, Type, Func<object?, object?>, Action<object?, object?>, IEnumerable<Attribute>)

Information of a field member of a type.

public FieldInfo(string Name, Type Type, Func<object?, object?> GetValueFunc, Action<object?, object?> SetValueFunc, IEnumerable<Attribute> Attributes)

Parameters

Name string

Name of the field.

Type Type

Type of the field.

GetValueFunc Func<object, object>

Function that returns the fields' value given the object.

SetValueFunc Action<object, object>

Function that sets the fields'value on the given object. The first argument is the object and the second the value to set.

Attributes IEnumerable<Attribute>

Optional collection of attributes on the field.

Properties

Attributes

Optional collection of attributes on the field.

public IEnumerable<Attribute> Attributes { get; init; }

Property Value

IEnumerable<Attribute>

GetValueFunc

Function that returns the fields' value given the object.

public Func<object?, object?> GetValueFunc { get; init; }

Property Value

Func<object, object>

Name

Name of the field.

public string Name { get; init; }

Property Value

string

SetValueFunc

Function that sets the fields'value on the given object. The first argument is the object and the second the value to set.

public Action<object?, object?> SetValueFunc { get; init; }

Property Value

Action<object, object>

Type

Type of the field.

public Type Type { get; init; }

Property Value

Type

Methods

GetAttribute<T>()

Returns the first attribute if any of the given type.

public T? GetAttribute<T>() where T : Attribute

Returns

T

The attribute on the given type if any or null otherwise.

Type Parameters

T

The attribute type to search.