XamlSerializer Class
Provides helper methods for easily serializing objects to and deserializing objects from XAML.
public class XamlSerializer
- Inheritance:
- Object Object
Constructors
XamlSerializer()
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 XmlReader.
public object LoadFromXmlReader(XmlReader reader)
Parameter | Type | Description |
---|---|---|
reader | XmlReader | The 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 XmlWriter.
public void SaveToXmlWriter(XmlWriter writer, object value)
Parameter | Type | Description |
---|---|---|
writer | XmlWriter | The XmlWriter to write to. |
value | Object | The object to serialize. |