XamlSerializer Class
Provides helper methods for easily serializing objects to and deserializing objects from XAML.
public class XamlSerializer
- Inheritance:
- object object
Constructors
XamlSerializer()
Initializes an instance of the class.
public XamlSerializer()
Methods
LoadFromFile(string)
Deserializes an object from the specified file.
public object LoadFromFile(string path)
Parameter | Type | Description |
---|---|---|
path | string | The path to the file from which to read an object. |
Returns
- object:
The object that was deserialized from XAML.
LoadFromStream(Stream)
Deserializes an object from the specified Stream.
public object LoadFromStream(Stream stream)
Parameter | Type | Description |
---|---|---|
stream | Stream | The Stream from which to read an object. |
Returns
- object:
The object that was deserialized from XAML.
LoadFromString(string)
Deserializes an object from the specified XAML string.
public object LoadFromString(string xaml)
Parameter | Type | Description |
---|---|---|
xaml | string | The XAML string from which to read an object. |
Returns
- object:
The object that was deserialized from XAML.
LoadFromXmlReader(XmlReader)
Deserializes an object from the specified System.Xml.XmlReader.
public object LoadFromXmlReader(XmlReader reader)
Parameter | Type | Description |
---|---|---|
reader | XmlReader | The System.Xml.XmlReader from which to read an object. |
Returns
- object:
The object that was deserialized from XAML.
SaveToFile(string, object)
Serializes the specified object to XAML within a file.
public void SaveToFile(string path, object value)
Parameter | Type | Description |
---|---|---|
path | string | The path to the output file. |
value | object | The object to serialize. |
SaveToStream(Stream, object)
Serializes the specified object to XAML within a Stream.
public void SaveToStream(Stream stream, object value)
Parameter | Type | Description |
---|---|---|
stream | Stream | The Stream to write to. |
value | object | The object to serialize. |
SaveToString(object)
Serializes the specified object to a XAML string.
public string SaveToString(object value)
Parameter | Type | Description |
---|---|---|
value | object | The object to serialize. |
Returns
- string:
The XAML string that was created.
SaveToXmlWriter(XmlWriter, object)
Serializes the specified object to XAML by using an System.Xml.XmlWriter.
public void SaveToXmlWriter(XmlWriter writer, object value)
Parameter | Type | Description |
---|---|---|
writer | XmlWriter | The System.Xml.XmlWriter to write to. |
value | object | The object to serialize. |