tl24 / jsonexserializer

Automatically exported from code.google.com/p/jsonexserializer
1 stars 1 forks source link

No serialization für Read-Only properties #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
    class Foo
    {
        public String Bar { get { return "Bar"; } } 
    }

Serializer serializer = new Serializer(typeof(Foo));
serializer.Serialize(foo, Console.Out);

Serializes to 
{
}

I know Foo cannot be deserialized, but IMO serialization should be possible.

Original issue reported on code.google.com by mwe.icom...@gmail.com on 19 Jul 2011 at 8:46

GoogleCodeExporter commented 9 years ago
Properties with no public setter are not serializable by default.  You need to 
add the JsonExProperty attribute to the property to change this.  See Issue 46.

Original comment by elliott....@gmail.com on 19 Jul 2011 at 11:18

GoogleCodeExporter commented 9 years ago
Ok, sounds reasonable. Is there a way to control this programmatically, not 
with attributes? Something like IncludeProperty()?

Original comment by mwe.icom...@gmail.com on 1 Aug 2011 at 9:03