开发者

Xaml Serialization

I want to use xaml serialization to store the configuration data of my application. This info is represented as readonly properties of a custom configuration class. When loading the application, the configuration class is deserialized through xamlservices api from a text file. However, I get an error in the form: Cannot set unknown member 'property_name'.' Line number '24' and line position '4'. This is because the setters are private. Is there a way to deserialize the obj开发者_StackOverflowect with readonly properties through xaml?


Yes, but you won't get round-trip serialization. You write a XAML document in which the object you want is created using a non-default constructor.

Look up info about the directive.


If its a collection property you can try using the ContentWrapperAttribute. You can also look at the ValueSerializerAttribute

More info can be found here http://msdn.microsoft.com/en-us/library/ff354959.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜