Class Serializer
This class provides methods for serializing and deserializing objects to and from XML files.
Inheritance
System.Object
Serializer
Namespace: VRSketchingGeometry.Serialization
Assembly: VRSketchingGeometry.dll
Syntax
public class Serializer
Methods
DeserializeFromXmlFile<T>(out T, String)
This will deserialize an object from a XML file.
Declaration
public static void DeserializeFromXmlFile<T>(out T targetObject, string path)
Parameters
| Type | Name | Description |
|---|---|---|
| T | targetObject | |
| System.String | path |
Type Parameters
| Name | Description |
|---|---|
| T |
SerializeToXmlFile<T>(T, String)
Declaration
public static void SerializeToXmlFile<T>(T objectToSerialize, string path)
Parameters
| Type | Name | Description |
|---|---|---|
| T | objectToSerialize | |
| System.String | path | File path of the xml file. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the object to be serialized. |
Remarks
The type t should only contain fields of types that can be automatically serialized by the .NET XmlSerializer class. This is the case for the data classes in the VRSketchingGeometry.Serialization namespace.
WriteTestXmlFile<T>(T)
Writes an object as xml to a default path.
Declaration
public static string WriteTestXmlFile<T>(T objectToWrite)
Parameters
| Type | Name | Description |
|---|---|---|
| T | objectToWrite |
Returns
| Type | Description |
|---|---|
| System.String |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the object to be serialized. |
Remarks
Default path is UnityEngine.Application.dataPath