LiquidTechnologies.XmlObjects Namespace / LjSerializer Class
Members Example

In This Topic
    LjSerializer Class
    In This Topic
    Performs serialization an de-serialization of classes marked up with the Liquid XML Objects serialization attributes.
    Object Model
    LjSerializer Class
    Public Class LjSerializer 
       Inherits Serializer
    public class LjSerializer : Serializer 
    The LjSerializer 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 LjSerializer should be created for each thread that uses it.
    Simple Reader Example Simple Writer Example
    LjSerializer serializer = new LjSerializer(typeof(MyElementClass).Assembly);
    using (FileStream fs = File.Create("MyJsonFile.json"))
        MyElementClass elmCls = (MyElementClass)serializer.Deserialize(fs);
    MyElementClass elmCls = ...;
    JsonWriterSettings xws = new JsonWriterSettings() { Indent = true };
    LjWriterSettings lxs = new LjWriterSettings { };
    using (FileStream fs = File.Create("MyJsonFile.json"))
        serializer.Serialize(fs, 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