LiquidTechnologies.XmlObjects Namespace / LxSerializer Class
Members Example

In This Topic
    LxSerializer Class
    In This Topic
    Performs serialization an de-serialization of classes marked up with the Liquid XML Objects serialization attributes.
    Object Model
    LxSerializer Class
    Public Class LxSerializer 
       Inherits Serializer
    public class LxSerializer : Serializer 
    The LxSerializer class can be quite expensive to create as it needs to scan assemblies for classes marked up with the Liquid XML Objects serialization attributes. For this reason is may be advantageous to cache a copy of the object and re-use it rather than re-creating it on demand. The class is currently NOT thread safe. An instance of LxSerializer should be created for each thread that uses it.
    Simple Reader Example Simple Writer Example
    LxSerializer serializer = new LxSerializer(typeof(MyElementClass).Assembly);
    using (XmlReader reader = XmlReader.Create("MyXmlFile.xml"))
        MyElementClass elmCls = (MyElementClass)serializer.Deserialize(reader);
    MyElementClass elmCls = ...;
    XmlWriterSettings xws = new XmlWriterSettings() { Indent = true };
    LxWriterSettings lxs = new LxWriterSettings { };
    using (XmlWriter writer = XmlWriter.Create("MyXmlFile.xml", xws))
        serializer.Serialize(writer, lxs, elmCls);
    Inheritance Hierarchy



    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows Server 2016, Windows Server 2012, Windows Server 2008. Please ensure you have the latest Service Pack for your operating system installed.

    See Also