In This Article

XamlSerializer Class

Provides helper methods for easily serializing objects to and deserializing objects from XAML.

public class XamlSerializer
Inheritance:
System.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 System.String

The path to the file from which to read an object.

Returns

System.Object:

The object that was deserialized from XAML.

LoadFromStream(Stream)

Deserializes an object from the specified System.IO.Stream.

public object LoadFromStream(Stream stream)
Parameter Type Description
stream System.IO.Stream

The System.IO.Stream from which to read an object.

Returns

System.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 System.String

The XAML string from which to read an object.

Returns

System.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 System.Xml.XmlReader

The System.Xml.XmlReader from which to read an object.

Returns

System.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 System.String

The path to the output file.

value System.Object

The object to serialize.

SaveToStream(Stream, Object)

Serializes the specified object to XAML within a System.IO.Stream.

public void SaveToStream(Stream stream, object value)
Parameter Type Description
stream System.IO.Stream

The System.IO.Stream to write to.

value System.Object

The object to serialize.

SaveToString(Object)

Serializes the specified object to a XAML string.

public string SaveToString(object value)
Parameter Type Description
value System.Object

The object to serialize.

Returns

System.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 System.Xml.XmlWriter

The System.Xml.XmlWriter to write to.

value System.Object

The object to serialize.

Inherited Members

  • System.Object.ToString()
  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object, System.Object)
  • System.Object.ReferenceEquals(System.Object, System.Object)
  • System.Object.GetHashCode()
  • System.Object.GetType()
  • System.Object.MemberwiseClone()