title: Create nested list (array) of strings from list of strings
body: <p>I have a list of names. From these, I want to create a new list of lists (or jagged array, if that works better), where the lower-level lists contain variations of the names.</p>
  
  <p>The basic idea is that you take a name and remove one letter at a time to create a list which features all of these creations, plus the original name. So for example, if your names are "bob" and "alice", I want to output</p>
  
  <pre><code>[["bo", "bb","ob","bob"], ["alic", "alie", "alce", "aice", "lice", "alice"]].
  </code></pre>
  
  <p>I can easily do this for just one name, but I run into problems I can't resolve when I try to create such a nested list (I'm relatively new to C#). Here's a toy example of what I've been trying:</p>
  
  <pre><code>List&lt;string&gt; names = new List&lt;string&gt;()
  {
      "alice",
      "bob",
      "curt"
  };
  
  //initialize jagged array
  string[][] modifiedNames = new string[names.Count][];
  
          //iterate over all names in "names" list
          foreach(string name in names)
          {
              int nameIndex = names.IndexOf(name);
  
              //initialize lower level of array
              modifiedNames[nameIndex] = new string[name.Length];
  
              //create variations of a given name
              for (int i = 0; i &lt; name.Length; i++)
              {
                  string newName = name.Substring(0, i) + name.Substring(i + 1);
  
                  if (modNames[nameIndex].Contains(newName) == false)
                      modNames[nameIndex].Add(newName);
              }
              modName.Add(name);
  
          }
  </code></pre>
  
  <p>I've tried several version thereof, both with lists and arrays, but to no avail. The error message I get in this case is</p>
  
  <blockquote>
    <p>'string[]' does not contain a definition for 'Add' and no accessible extension  method 'Add' accepting a first argument of type 'string[]' could be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>Thanks a lot for your help!</p>