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
TypeThe type
Returns
- bool
True if the type can be null
GetAllInterfaces(TypeInfo)
public static IEnumerable<Type> GetAllInterfaces(this TypeInfo typeInfo)
Parameters
typeInfo
TypeInfo
Returns
GetAllInterfaces(Type)
public static IEnumerable<Type> GetAllInterfaces(this Type type)
Parameters
type
Type
Returns
GetAllProperties(TypeInfo)
public static IEnumerable<PropertyInfo> GetAllProperties(this TypeInfo typeInfo)
Parameters
typeInfo
TypeInfo
Returns
GetAllProperties(Type)
public static IEnumerable<PropertyInfo> GetAllProperties(this Type type)
Parameters
type
Type
Returns
GetAllStaticProperties(Type)
public static IEnumerable<PropertyInfo> GetAllStaticProperties(this Type type)
Parameters
type
Type
Returns
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
ICustomAttributeProviderAn 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
GetTypeName(Type)
Returns an easy-to-read type name from the specified Type
public static string GetTypeName(this Type type)
Parameters
type
Type
Returns
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
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
IsAnonymousType(Type)
Returns true if the type is an anonymous type
public static bool IsAnonymousType(this Type type)
Parameters
type
Type
Returns
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
TypeThe 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
TypeThe type to evaluate
assignableType
TypeThe 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
TypeThe 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
IsInNamespace(Type, string)
Returns true if the type is contained within the namespace
public static bool IsInNamespace(this Type type, string nameSpace)
Parameters
Returns
IsInterfaceOrConcreteClass(Type)
public static bool IsInterfaceOrConcreteClass(this Type type)
Parameters
type
Type
Returns
IsNullable(Type, out Type?)
Determines if the type is a nullable type
public static bool IsNullable(this Type type, out Type? underlyingType)
Parameters
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
TypeInfoThe 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
TypeThe 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