zach-yu / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

DefaultValue not used #420

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
See this code:

[ProtoMember(5), DefaultValue(300)]
public string Route_Id { get; set; }

Route_Id will be null, unless set in the source.

In the case of an enum:

[ProtoMember(4), 
DefaultValue(GTFSTripDescriptor.GTFSScheduleRelationship.SCHEDULED)]
        public GTFSTripDescriptor.GTFSScheduleRelationship Schedule_Relationship { get; set; }

Schedule_Relationship will be 0 - if there is no enum with value 0, then it 
will merely show 0. 

Is this intended? I prefer not to work with separated private and public 
properties.

Original issue reported on code.google.com by pts...@gmail.com on 2 Dec 2013 at 1:09