c# - Dictionary in Settings throws an exception? -
i want save dictionary in default usersettings class of project.
i've tried following in code of settings file fails:
<setting name="mediakeys" type="system.collections.objectmodel.dictionary<system.input.key, system.io.fileinfo>" scope="user"> <value profile="(default)" /> </setting>
i error message when @ ui settings:
could not load file or assembly 'system.io.fileinfo>' or 1 of dependencies. parameter incorrect. (exception hresult: 0x80070057 (e_invalidarg))
bearing in mind, please, deal whole serializable dictionary @ point in time, why getting exception? non-serializable objects (such fileinfo, have tested) not throw exception.
.net settings not handle generics well. do:
[xmlroot("dictionary")] public class mydictionary : serializabledictionary<int, string> { }
Comments
Post a Comment