Bugzilla – Bug 325359
[automatic properties] generated field's name is unrelated to property name
Last modified: 2007-11-13 10:08:44 UTC
---- Reported by jan.oravec@6com.sk 2007-09-04 12:07:05 MST ---- This is more wish than bug. It would be nice if generated field name was predictable from property name in automatic properties so that when object is serialized, class modified (e.g. changed order of properties), then deserialized, it would still work. Application with data model in db4o is a good example which would benefit from stable field name. I am not sure what specification says, but it seems that MSFT recognized this problem and recently changed .NET to use field name "<Name>k__BackingField" when property name is "Name". There are 2 recent articles with IL code showing usage of this new name: http://jmayo.spaces.live.com/blog/cns!5F243997972597CE!444.entry http://footheory.com/blogs/bennie/archive/2007/08/02/new-features-in-c-3-0-part-3-automatic-properties-object-initializers-and-collection-initializers.aspx I do not have any MSFT products around, so I was not able to check this. It would be nice if Mono use same name pattern, so that serialization is compatible between Mono and .NET. Unknown operating system unknown. Setting to default OS "Other".
Fixed in SVN.