TypeInfo
Utility class providing methods for obtaining information about different types.
Methods
ApproximateIsBlittable
public static bool ApproximateIsBlittable<T>()
true
if a type is blittable, else false
. This method uses an approximation, and may not work with generic types with blittable (unmanaged) constraints.
ApproximateIsBlittable
public static bool ApproximateIsBlittable(Type type)
true
if a type is blittable, else false
. This method uses an approximation, and may not work with generic types with blittable (unmanaged) constraints.
MarshalledSizeOf
public static int MarshalledSizeOf<T>()
Usage
Check if a Type is Blittable (Generic)
bool isBlittable = TypeInfo.ApproximateIsBlittable<int>();
Check if a Type is Blittable (Non-Generic)
bool isBlittable = TypeInfo.ApproximateIsBlittable(typeof(int));
Check size of Type After Marshalling
int size = TypeInfo.MarshalledSizeOf<int>();