Skip to content

larrynung/LevelUp.Serializer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LevelUp.Serializer

Build status

Feature

  • Ease of use
  • Supports almost all serializer, like Binary、Xml、Soap、Json、DataContract.
  • Support serialize to file、serialize to stream、deserialize from file、deserialize from stream.
  • Support Xml encryption.
  • Support serialize accelerate through the XML serialization assemble.

Example

using System;
using System.Runtime.Serialization;
using LevelUp.Serializer;

namespace ConsoleApplication46
{
    [DataContract]
    [Serializable]
    public class Person
    {
        [DataMember]
        public string Name { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            var larry = new Person()
            {
                Name = "Larry Nung"
            };

            //Xml
            var xml = Serializer.SerializeToText(larry, SerializerType.Xml);

            Console.WriteLine(xml);


            xml = larry.ToXML();

            Console.WriteLine(xml);


            larry = Serializer.DeSerializeFromText<Person>(xml, SerializerType.Xml);

            Console.WriteLine(larry.Name);


            //JSON
            var json = Serializer.SerializeToText(larry, SerializerType.Json);

            Console.WriteLine(json);


            json = larry.ToJSON();

            Console.WriteLine(json);


            larry = Serializer.DeSerializeFromText<Person>(json, SerializerType.Json);

            Console.WriteLine(larry.Name);


            //SOAP
            var soap = Serializer.SerializeToText(larry, SerializerType.Soap);

            Console.WriteLine(soap);

            
            larry = Serializer.DeSerializeFromText<Person>(soap, SerializerType.Soap);

            Console.WriteLine(larry.Name);
        }
    }
}

Link

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published