Class TypeExtensions
- Namespace
- AetherUtils.Core.Extensions
- Assembly
- AetherUtils.Core.dll
Provides extension methods for manipulating generic object types.
public static class TypeExtensions
- Inheritance
-
TypeExtensions
- Inherited Members
Methods
CanSerializeJson<T>(T)
Get a value indicating if this object can be serialized via JSON serializion.
[UsedImplicitly]
public static bool CanSerializeJson<T>(this T obj) where T : class
Parameters
objT- The instance of the object with type
T.
Returns
- bool
trueif the object can be serialized;falseotherwise.
Type Parameters
T- The Type of the object to check.
Exceptions
- ArgumentNullException
- If
objwasnull.
CanSerializeXml<T>(T)
Get a value indicating if this object can be serialized via XML serialization.
public static bool CanSerializeXml<T>(this T obj) where T : class
Parameters
objT- The instance of the object with type
T.
Returns
- bool
trueif the object can be serialized;falseotherwise.
Type Parameters
T- The Type of the object to check.
Exceptions
- ArgumentNullException
- If
objwasnull.
GetFriendlyName(Type)
Get the friendly, displayable name for the Type.
[UsedImplicitly]
public static string GetFriendlyName(this Type type)
Parameters
Returns
Exceptions
- ArgumentNullException
- If
typewasnull.
SerializeJson<T>(T)
Serializes a .NET object to a JSON string.
public static string SerializeJson<T>(this T obj) where T : class
Parameters
objT- An instance of
Tto serialize.
Returns
- string
- A JSON string representing the serialized object,
obj.
Type Parameters
T- The Type of the object to serialize.
Exceptions
- ArgumentNullException
- If
objwasnull.
SerializeXml<T>(T)
Serializes a .NET object to an XML string.
public static string SerializeXml<T>(this T obj) where T : class
Parameters
objT- An instance of
Tto serialize.
Returns
- string
- An XML string representing the serialized object,
obj.
Type Parameters
T- The Type of the object to serialize.
Exceptions
- ArgumentNullException
- If
objwasnull.