Sphyrnidae Common Library  2.0.1
Shared Utilities/Library
Sphyrnidae.Common.Serialize.Serialization Class Reference

Handles serialization (and deserialization) of an object. This effectively is a wrapper around JsonConvert methods. But also allows for XML serialization More...

Static Public Member Functions

static string SerializeJson< T > (this T item, JsonSerializerSettings jsonSettings=null)
 Serializes an object to JSON More...
 
static string SerializeXml< T > (this T item, XmlSerializer serializer=null)
 Serializes an object to XML More...
 
static T DeserializeJson< T > (this string json, JsonSerializerSettings jsonSettings=null)
 Deserializes an object from JSON More...
 
static T DeserializeXml< T > (this string xml, XmlSerializer serializer=null)
 Deserializes an object from XML More...
 
static object DeserializeXmlAs< T > (this string xml, XmlSerializer serializer=null)
 Deserializes the string and does a convert to the type More...
 

Detailed Description

Handles serialization (and deserialization) of an object. This effectively is a wrapper around JsonConvert methods. But also allows for XML serialization

There is currently no exception handling for these methods. Consider wrapping these calls in SafeTry.IgnoreException method

Member Function Documentation

◆ DeserializeJson< T >()

static T Sphyrnidae.Common.Serialize.Serialization.DeserializeJson< T > ( this string  json,
JsonSerializerSettings  jsonSettings = null 
)
static

Deserializes an object from JSON

Template Parameters
TThe type of object
Parameters
jsonThe json to convert
jsonSettingsOptional: The json settings to use
Returns
The converted object

◆ DeserializeXml< T >()

static T Sphyrnidae.Common.Serialize.Serialization.DeserializeXml< T > ( this string  xml,
XmlSerializer  serializer = null 
)
static

Deserializes an object from XML

Template Parameters
TThe type of object
Parameters
xmlThe xml to convert
serializerOptional: The XML Serializer to use
Returns
The converted object

◆ DeserializeXmlAs< T >()

static object Sphyrnidae.Common.Serialize.Serialization.DeserializeXmlAs< T > ( this string  xml,
XmlSerializer  serializer = null 
)
static

Deserializes the string and does a convert to the type

Template Parameters
TThe type of object being deserialized/converted
Parameters
xmlThe xml to deserialize
serializerOptional: The XML Serializer to use
Returns
An object that is 'converted' to the type

◆ SerializeJson< T >()

static string Sphyrnidae.Common.Serialize.Serialization.SerializeJson< T > ( this T  item,
JsonSerializerSettings  jsonSettings = null 
)
static

Serializes an object to JSON

Parameters
itemThe item being serialized
jsonSettingsThe json settings to use
Returns
The Json representation of the object

◆ SerializeXml< T >()

static string Sphyrnidae.Common.Serialize.Serialization.SerializeXml< T > ( this T  item,
XmlSerializer  serializer = null 
)
static

Serializes an object to XML

Parameters
itemThe item being serialized
serializerThe XML Serializer to use
Returns
The XML representation of the object

The documentation for this class was generated from the following file: