This is my Settings.setting file:
<Setting Name="AutoCompleteList" Type="System.Collections.Generic.LinkedList<string>" Scope="User">
<Value Profile="(Default)" />
</Setting>
and this is my Settings.Designer.cs:
public global::System.Collections.Generic.LinkedList<string> AutoCompleteList {
get {
return ((global::System.Collections.Generic.LinkedList<string>)(this["AutoCompleteList"]));
}
set {
this["AutoCompleteList"] = value;
}
}
Programs.cs
class Program
{
private static LinkedList<string> _autoCompleteList;
static void Main()
{
_autoCompleteList = new LinkedList<string>((new[] {"one", "two"}));
Settings.Default.AutoCompleteList = _autoCompleteList;
Settings.Default.Save(); //Nothing is saved. (Silently and without any error)
_autoCompleteList = Settings.Default.AutoCompleteList; //null
}
}
If I use List<string> instead of LinkedList<string> all things work; but I need LinkedList, because it makes it easier to access the previous and next elements. Yes. It's possible using List in app settings and load it into a LinkedList at runtime, but I want to know why LinkedList can't be saved in app settings.
Also I should have made it clear that all my settings are scoped as "User"
Linked list is a data structure that is implemented in memory only because each element also linked to another element. That's why it can't be saved. It just can be implemented in memory.