Reputation: 3585
I want to save a dictionary in the default UserSettings class of my project.
I've tried the following in the code of the Settings file but it fails:
<Setting Name="MediaKeys" Type="System.Collections.ObjectModel.Dictionary<System.Input.Key, System.IO.FileInfo>" Scope="User">
<Value Profile="(Default)" />
</Setting>
I get this error message when I look at the UI for the Settings:
Could not load file or assembly 'System.IO.FileInfo>' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Bearing in mind, please, that I will deal with the whole Serializable Dictionary at another point in time, why am I getting this exception? Even non-serializable objects (such as FileInfo, as I have tested) do not throw this exception.
Upvotes: 0
Views: 52
Reputation: 7354
.NET settings do not handle generics very well. This is what I do:
[XmlRoot("dictionary")]
public class MyDictionary : SerializableDictionary<int, string>
{
}
Upvotes: 1