Skip to content

TypeExtensions Class ​

Definition ​

Extension methods for Type.

c#
public static class TypeExtensions

View source

Methods ​

NameDescription
EnumerateNestedTypes(Type)If a type is a nested type then it enumerates its parents, starting at the outermost type, followed by the type itself. If it is not nested then it just returns the type.
GetAccessibility(Type)Returns the Accessibility of the specified Type.
IsProtected(Type)Returns true if the type is protected as viewed from an external assembly, that is, its Accessibility is Protected or ProtectedInternal; false otherwise.
IsPublic(Type)Returns true if the type is public, nested or not, that is, its Accessibility is Public; false otherwise.
IsPublicOrProtected(Type)Returns true if the type is public or protected as viewed from an external assembly, that is, its Accessibility is Public, Protected or ProtectedInternal; false otherwise.
IsReadOnlyStruct(Type)Returns true if the specified Type is a readonly struct; false otherwise.
IsRecord(Type)Returns true if the specified Type is a record class or record struct; false otherwise.
IsRefStruct(Type)Returns true if the specified Type is a ref struct; false otherwise.
IsStatic(Type)Returns true if the specified Type is static; false otherwise.