GithubHelp home page GithubHelp logo

sillyxml's Introduction

SillyXml

Immutable class XML serialization for the people!

With C#6 we can finally write immutable classes without going insane by using the new getter-only property syntax.

public class ImmutableClass {
    public ImmutableClass(string fruit) {
        Fruit = fruit;
    }

    public string Fruit { get; }
}

However if we try to serialize this class with the XmlSerializer class in the standard library it won't work since it doesn't have a parameterless constructor and since the property has no setters - so we're forced to add those or create a separate class just for the serialization. Both of these options feel pretty bad - and thus this library was born.

Getting started

SillyXml is available on Nuget, so to add it to your project simply do

Install-Package SillyXml

or if you prefer using Paket add the following to your paket.dependencies

nuget SillyXml

Serializing an object to XML

SillyXml has a super-simple API, to serialize an object just do

string xml = XmlSerializer.ToXml(new ImmutableClass("Banana"));

and that's it!

Issues and problems

Please register issues on the github issue tracker if you find any bugs or features that you feel should be added.

License and contributions

This project is licensed under the Apache License.

Contributions are welcome, just fork and send a pull request.
If you wish to discuss any potential features etc just open an issue in the issue tracker.

sillyxml's People

Contributors

wastaz avatar

Watchers

Steffen Forkmann avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.