Show / Hide Table of Contents

Class SerializationHelper

Json serialization and deserialization using the custom resolver VerifierResolver

Inheritance
System.Object
SerializationHelper
Namespace: SigStat.Common.Helpers
Assembly: SigStat.Common.dll
Syntax
public class SerializationHelper : object

Methods

| Improve this Doc View Source

Deserialize<T>(String)

Constructs object from strings that were serialized previously

Declaration
public static T Deserialize<T>(string s)
    where T : class
Parameters
Type Name Description
System.String s

The serialized string

Returns
Type Description
T

The object that was serialized

Type Parameters
Name Description
T

A type which has a public parameterless constructor

| Improve this Doc View Source

DeserializeFromFile<T>(String)

Constructs object from file given by a path

Declaration
public static T DeserializeFromFile<T>(string path)
    where T : class
Parameters
Type Name Description
System.String path

Relative path to the file

Returns
Type Description
T

The object that was serialized to the file

Type Parameters
Name Description
T

A type which has a public parameterless constructor

| Improve this Doc View Source

GetSettings(Boolean)

Settings used for the serialization methods

Declaration
public static JsonSerializerSettings GetSettings(bool compactFeatures = false)
Parameters
Type Name Description
System.Boolean compactFeatures
Returns
Type Description
JsonSerializerSettings

A new settings object

| Improve this Doc View Source

JsonSerialize<T>(T, Boolean)

Creates json string from object

Declaration
public static string JsonSerialize<T>(T o, bool compactFeatures = false)
Parameters
Type Name Description
T o

The object

System.Boolean compactFeatures

Set to true to use compact feature notation

Returns
Type Description
System.String

The json string constructed from the object

Type Parameters
Name Description
T

The type of the object

| Improve this Doc View Source

JsonSerializeToFile<T>(T, String, Boolean)

Writes object to file to the given by path in json format

Declaration
public static void JsonSerializeToFile<T>(T o, string path, bool compactFeatures = false)
Parameters
Type Name Description
T o

The object

System.String path

Relative path

System.Boolean compactFeatures

Set to true to use compact feature notation

Type Parameters
Name Description
T

The type of the object

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX