Application Settings Architecture
http://msdn.microsoft.com/en-us/library/8eyb2ct1.aspx
Ok, an old post, but I remembered it when I came across a similar situation:
...
If you go to Project / Project Properties (in VS2008 or VS2010).
There is a "Settings" tab.
If you add a new value....
One of the types is called:
System.Collections.Specialized.StringCollection
Give it a name (I used "FavoriteColors").
Set the type (as instructed above).
Set the value(s).
The "String Collection Editor" says "Enter the strings in the collection (one per line)".
I entered:
Red
Yellow
Black
White
This will add some xml to your app.config file.
<setting name="FavoriteColors" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>red</string>
<string>yellow</string>
<string>black</string>
<string>white</string>
</ArrayOfString>
</value>
</setting>
(You'll be better off going through the steps rather than pasting the xml above, because (for conciseness) I did not add all the xml to this post that is generated.
You should be able to "get at" the values via code like this:
private void ShowMyFavoriteColors()
{
Properties.Settings.Default.FavoriteColors.Cast<string>().ToList().ForEach(myfavcolor =>
{
string temp = myfavcolor;
});
}
Note, the steps above will produce the below C# code (auto code created for you.... it is not code you create)
but the code looks like this:
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute(@"<?xml version=""1.0"" encoding=""utf-16""?>
<ArrayOfString xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<string>red</string>
<string>yellow</string>
<string>black</string>
<string>white</string>
</ArrayOfString>")]
public global::System.Collections.Specialized.StringCollection FavoriteColors {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["FavoriteColors"]));
}
}
}
}