TypeUtility

public static class TypeUtility
Provides some utility methods for types whose exact state may be unknown at compiletime.

Methods

CanDuplicate

#
public static bool CanDuplicate(object value, DuplicationMethods filter)
Test whether a duplication mechanism is available for the given object.
value (object)Value to test.
filter (DuplicationMethods)Mechanism filter.
True if there's a known duplication mechanism.

CanDuplicate

#
public static bool CanDuplicate(object value)
Test whether a duplication mechanism is available for the given object.
value (object)Value to test.
True if there's a known duplication mechanism.

CanDuplicate<T>

#
public static bool CanDuplicate<T>()
Test whether a duplication mechanism is available for the given type.
True if there's a known duplication mechanism.

CanDuplicate<T>

#
public static bool CanDuplicate<T>(DuplicationMethods filter)
Test whether a duplication mechanism is available for the given type.
filter (DuplicationMethods)Mechanism filter.
True if there's a known duplication mechanism.

DetermineFlavour

#
public static TypeFlavour DetermineFlavour(object value)
Figure out the TypeFlavour of a specific type. Note that this overload is unable to determine whether the value is a nullable struct. If a nullable struct is supplied and it's null, TypeFlavour.None is returned. If the type is not null, TypeFlavour.Struct is returned. We recommend using the DetermineFlavour<T<() overload.
value (object)Value of type to examine.
TypeFlavour associates with T.

DetermineFlavour

#
public static TypeFlavour DetermineFlavour(Type type)
Figure out the TypeFlavour of a specific type.
type (Type)Type to examine.
TypeFlavour associated with T.

DetermineFlavour<T>

#
public static TypeFlavour DetermineFlavour<T>()
Figure out the TypeKind of a specific type.
TypeKind associates with T.

GetDuplicationDelegate<T>

#
public static Func<T, T> GetDuplicationDelegate<T>()
Try and get a duplication delegate that fits the relevant type. Duplication delegates can be constructed for structs, nullable structs, types with registered TypeAssistants, and types that implement ICloneable, ISerializable and/or IStorable, in that order.
Predefined duplication delegate if any.

GetDuplicationDelegate<T>

#
public static Func<T, T> GetDuplicationDelegate<T>(DuplicationMethods filter)
Try and get a duplication delegate that fits the relevant type. Duplication delegates can be constructed for structs, nullable structs, types with registered TypeAssistants, and types that implement ICloneable, ISerializable and/or IStorable, in that order.
filter (DuplicationMethods)Type filter.
Predefined duplication delegate if any.

IsNullable<T>

#
public static bool IsNullable<T>()
Gets whether a specific type is a struct.

TryDuplicateObject

#
public static object TryDuplicateObject(object value, DuplicationMethods filter)
Try and duplicate an object. Duplication is defined for structs, nullable structs, types with registered TypeAssistants, and types that implement ICloneable, ISerializable and/or IStorable, in that order.
value (object)Value to duplicate.
filter (DuplicationMethods)Duplication methods to test.
Duplicated object or null.

TryDuplicateObject

#
public static object TryDuplicateObject(object value)
Try and duplicate an object. Duplication is defined for structs, nullable structs, types with registered TypeAssistants, and types that implement ICloneable, ISerializable and/or IStorable, in that order.
value (object)Value to duplicate.
Duplicated object or null.