Table of Contents

Class ReflectionExtensions

Namespace
SunamoExtensions.Utf8Json
Assembly
SunamoExtensions.dll

Extension methods for Reflection types

public static class ReflectionExtensions
Inheritance
ReflectionExtensions
Inherited Members

Methods

GetAllFields(Type)

Gets all fields of the type including inherited ones

public static IEnumerable<FieldInfo> GetAllFields(this Type type)

Parameters

type Type

Type to get fields from

Returns

IEnumerable<FieldInfo>

Enumerable of all fields

GetAllProperties(Type)

Gets all properties of the type NOTE: This doesn't return all properties in some cases (e.g., when returning from CompilerOptions)

public static IEnumerable<PropertyInfo> GetAllProperties(this Type type)

Parameters

type Type

Type to get properties from

Returns

IEnumerable<PropertyInfo>

Enumerable of all properties

GetGetMethod(PropertyInfo)

Gets the get accessor method for the property

public static MethodInfo? GetGetMethod(this PropertyInfo propInfo)

Parameters

propInfo PropertyInfo

Property to get accessor from

Returns

MethodInfo

Get accessor method

GetSetMethod(PropertyInfo)

Gets the set accessor method for the property

public static MethodInfo? GetSetMethod(this PropertyInfo propInfo)

Parameters

propInfo PropertyInfo

Property to get accessor from

Returns

MethodInfo

Set accessor method

IsAnonymous(TypeInfo)

Determines whether the type is an anonymous type

public static bool IsAnonymous(this TypeInfo type)

Parameters

type TypeInfo

Type to check

Returns

bool

True if the type is an anonymous type

IsConstructedGenericType(TypeInfo)

Determines whether the type is a constructed generic type

public static bool IsConstructedGenericType(this TypeInfo type)

Parameters

type TypeInfo

Type to check

Returns

bool

True if the type is a constructed generic type

IsNullable(TypeInfo)

Determines whether the type is a nullable value type

public static bool IsNullable(this TypeInfo type)

Parameters

type TypeInfo

Type to check

Returns

bool

True if the type is Nullable<T>

IsPublic(TypeInfo)

Determines whether the type is public

public static bool IsPublic(this TypeInfo type)

Parameters

type TypeInfo

Type to check

Returns

bool

True if the type is public