开发者

VS Settings.settings Designer always resets serializeAs attribute to "String" - How to prevent?

开发者 https://www.devze.com 2023-03-30 14:52 出处:网络
I\'d like to save a custom setting to app.config and still be able to add new settings through the Settings.settings designer in Visual Studio.

I'd like to save a custom setting to app.config and still be able to add new settings through the Settings.settings designer in Visual Studio.

However, the custom property is stored in app.config with the serializeAs="Xml" attribute and looks quite weird when it is converted to String, which is what the designer does by default. Everytime the designer is opened, it resets the attribute to "String" and messes up the content.

Does anyone know how to prevent this? How is it even possible to store custom settings with other serialization t开发者_运维问答ypes if the designer breaks them constantly?

Adding SettingsSerializeAsAttribute to the Settings.Designer.cs file is of course fruitless, because the designer (like every designer) doesn't even look if something has changed in there and simply overwrites it...

Thanks in advance for any answers!

0

精彩评论

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