Initializing a StringCollection Setting

If you want to enter values in the Settings GUI, on the far right there is a "..." button which allows you to enter the initial string values each separated on a line. It then converts that into XML as such:

<?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>String1</string>
  <string>String2</string>
</ArrayOfString>

edit: Yes you need to initialize the StringCollection and my above answer is the way to do it using the GUI. Thought it would help people (like me) who stumbled on this post looking for a way to initialize a StringCollection setting like OP needed to do.


I should probably explain a bit further. Let's say you were going to use a list of strings. You can declare:

IList<string> a;

At this point a = null and null does not have an Add method. If you initialize:

IList<string> a = new List<string>();

Now a = an empty list of strings. It will at this point have an Add method to use to add strings to the list.