Method GetStaticFields
GetStaticFields<TField>(Type, bool)
Retrieves all static fields of a specified type from a given container type.
public static IEnumerable<TField> GetStaticFields<TField>(Type containerType, bool includeNonPublic = false)
Parameters
containerTypeTypeThe type that contains the static fields to search. Must not be null.
includeNonPublicboolThe bool value indicating whether to include non-public fields.
Returns
- IEnumerable<TField>
An IEnumerable<T> containing all static fields of type
TFielddefined in the specifiedcontainerType. Returns an empty collection if no matching fields are found.
Type Parameters
TFieldThe type of the static fields to retrieve.
Remarks
This method searches for static fields in the specified
type and filters them by the specified field type.
Only fields that are assignable to TField are included
in the result.