Table of Contents

Class TypeExtensions

Namespace
MassTransit.Internals
Assembly
MassTransit.Abstractions.dll
public static class TypeExtensions
Inheritance
TypeExtensions
Inherited Members

Methods

CanBeNull(Type)

Determines if a type can be null

public static bool CanBeNull(this Type type)

Parameters

type Type

The type

Returns

bool

True if the type can be null

GetAllInterfaces(TypeInfo)

public static IEnumerable<Type> GetAllInterfaces(this TypeInfo typeInfo)

Parameters

typeInfo TypeInfo

Returns

IEnumerable<Type>

GetAllInterfaces(Type)

public static IEnumerable<Type> GetAllInterfaces(this Type type)

Parameters

type Type

Returns

IEnumerable<Type>

GetAllProperties(TypeInfo)

public static IEnumerable<PropertyInfo> GetAllProperties(this TypeInfo typeInfo)

Parameters

typeInfo TypeInfo

Returns

IEnumerable<PropertyInfo>

GetAllProperties(Type)

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

Parameters

type Type

Returns

IEnumerable<PropertyInfo>

GetAllStaticProperties(Type)

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

Parameters

type Type

Returns

IEnumerable<PropertyInfo>

GetAttribute<T>(ICustomAttributeProvider)

Returns the first attribute of the specified type for the object specified

public static IEnumerable<T> GetAttribute<T>(this ICustomAttributeProvider provider) where T : Attribute

Parameters

provider ICustomAttributeProvider

An attribute provider, which can be a MethodInfo, PropertyInfo, Type, etc.

Returns

IEnumerable<T>

The attribute instance if found, or null

Type Parameters

T

The type of attribute

GetStaticProperties(Type)

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

Parameters

type Type

Returns

IEnumerable<PropertyInfo>

GetTypeName(Type)

Returns an easy-to-read type name from the specified Type

public static string GetTypeName(this Type type)

Parameters

type Type

Returns

string

HasAttribute<T>(ICustomAttributeProvider)

Determines if the target has the specified attribute

public static bool HasAttribute<T>(this ICustomAttributeProvider provider) where T : Attribute

Parameters

provider ICustomAttributeProvider

Returns

bool

Type Parameters

T

IsAnonymousType(TypeInfo)

Returns true if the TypeInfo is an anonymous type

public static bool IsAnonymousType(this TypeInfo typeInfo)

Parameters

typeInfo TypeInfo

Returns

bool

IsAnonymousType(Type)

Returns true if the type is an anonymous type

public static bool IsAnonymousType(this Type type)

Parameters

type Type

Returns

bool

IsConcrete(Type)

Determines if a type is neither abstract nor an interface and can be constructed.

public static bool IsConcrete(this Type type)

Parameters

type Type

The type to check

Returns

bool

True if the type can be constructed, otherwise false.

IsConcreteAndAssignableTo(Type, Type)

Determines if a type can be constructed, and if it can, additionally determines if the type can be assigned to the specified type.

public static bool IsConcreteAndAssignableTo(this Type type, Type assignableType)

Parameters

type Type

The type to evaluate

assignableType Type

The type to which the subject type should be checked against

Returns

bool

True if the type is concrete and can be assigned to the assignableType, otherwise false.

IsConcreteAndAssignableTo<T>(Type)

Determines if a type can be constructed, and if it can, additionally determines if the type can be assigned to the specified type.

public static bool IsConcreteAndAssignableTo<T>(this Type type)

Parameters

type Type

The type to evaluate

Returns

bool

True if the type is concrete and can be assigned to the assignableType, otherwise false.

Type Parameters

T

The type to which the subject type should be checked against

IsFSharpType(TypeInfo)

Returns true if the type is an FSharp type (maybe?)

public static bool IsFSharpType(this TypeInfo typeInfo)

Parameters

typeInfo TypeInfo

Returns

bool

IsInNamespace(Type, string)

Returns true if the type is contained within the namespace

public static bool IsInNamespace(this Type type, string nameSpace)

Parameters

type Type
nameSpace string

Returns

bool

IsInterfaceOrConcreteClass(Type)

public static bool IsInterfaceOrConcreteClass(this Type type)

Parameters

type Type

Returns

bool

IsNullable(Type, out Type?)

Determines if the type is a nullable type

public static bool IsNullable(this Type type, out Type? underlyingType)

Parameters

type Type

The type

underlyingType Type

The underlying type of the nullable

Returns

bool

True if the type can be null

IsOpenGeneric(TypeInfo)

Determines if the TypeInfo is an open generic with at least one unspecified generic argument

public static bool IsOpenGeneric(this TypeInfo typeInfo)

Parameters

typeInfo TypeInfo

The TypeInfo

Returns

bool

True if the TypeInfo is an open generic

IsOpenGeneric(Type)

Determines if the type is an open generic with at least one unspecified generic argument

public static bool IsOpenGeneric(this Type type)

Parameters

type Type

The type

Returns

bool

True if the type is an open generic

IsValueTypeOrObject(Type)

True if the type is a value type, or an object type that is treated as a value by MassTransit

public static bool IsValueTypeOrObject(this Type valueType)

Parameters

valueType Type

Returns

bool