Class SerializationUtils
Inheritance
System.Object
SerializationUtils
Assembly: Eco.Core.dll
Syntax
public static class SerializationUtils : Object
Methods
Clone<T>(T)
Declaration
public static T Clone<T>(T obj)
Parameters
| Type |
Name |
Description |
| T |
obj |
|
Returns
Type Parameters
CreateSerializer(Boolean, Boolean, ObjectCreationHandling)
Declaration
public static JsonSerializer CreateSerializer(bool preserveReferences = false, bool isWriting = false, ObjectCreationHandling objectCreationHandling)
Parameters
| Type |
Name |
Description |
| System.Boolean |
preserveReferences |
|
| System.Boolean |
isWriting |
|
| Newtonsoft.Json.ObjectCreationHandling |
objectCreationHandling |
|
Returns
| Type |
Description |
| Newtonsoft.Json.JsonSerializer |
|
CreateSerializerSettings(Boolean, Boolean)
Declaration
public static JsonSerializerSettings CreateSerializerSettings(bool preserveReferences = false, bool isWriting = false)
Parameters
| Type |
Name |
Description |
| System.Boolean |
preserveReferences |
|
| System.Boolean |
isWriting |
|
Returns
| Type |
Description |
| Newtonsoft.Json.JsonSerializerSettings |
|
DeserializeJson(String, Type)
Declaration
public static object DeserializeJson(string json, Type type)
Parameters
| Type |
Name |
Description |
| System.String |
json |
|
| System.Type |
type |
|
Returns
| Type |
Description |
| System.Object |
|
DeserializeJson<T>(String)
Declaration
public static T DeserializeJson<T>(string json)
Parameters
| Type |
Name |
Description |
| System.String |
json |
|
Returns
Type Parameters
GetClassMigrationSerializerType(Type)
Declaration
public static Type GetClassMigrationSerializerType(Type type)
Parameters
| Type |
Name |
Description |
| System.Type |
type |
|
Returns
| Type |
Description |
| System.Type |
|
PopulateObjectWithJson(JObject, Object, ObjectCreationHandling)
Populate json from the JObject. Useful if you need to change json on the way so it won't need to read it twice
Declaration
public static void PopulateObjectWithJson(JObject json, object instance, ObjectCreationHandling objectCreationHandling)
Parameters
| Type |
Name |
Description |
| Newtonsoft.Json.Linq.JObject |
json |
|
| System.Object |
instance |
|
| Newtonsoft.Json.ObjectCreationHandling |
objectCreationHandling |
|
PopulateObjectWithJson(String, Object, ObjectCreationHandling)
Populate json from the string (jsonText)
Declaration
public static void PopulateObjectWithJson(string json, object instance, ObjectCreationHandling objectCreationHandling)
Parameters
| Type |
Name |
Description |
| System.String |
json |
|
| System.Object |
instance |
|
| Newtonsoft.Json.ObjectCreationHandling |
objectCreationHandling |
|
SerializeJson(Object, Boolean)
Declaration
public static string SerializeJson(object obj, bool preserveReferences = false)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
| System.Boolean |
preserveReferences |
|
Returns
| Type |
Description |
| System.String |
|
SerializeRawJson(Object)
Declaration
public static string SerializeRawJson(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.String |
|
SerializeRawJsonIndented(Object)
Declaration
public static string SerializeRawJsonIndented(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.String |
|
UpdateAllConfigTemplates()
Declaration
public static void UpdateAllConfigTemplates()