title: Split string into custom List<T>
body: <p>I need to split a custom string into the following format using C#.</p>
  
  <p>The following string: <code>AD=Demo,OU=WEB,OU=IT,L=MyCity,C=MyCountry</code>, i want to split it at comma into a </p>
  
  <blockquote>
    <p>List&lt;CustomDictionary&gt; myList = new
    List&lt;CustomDictionary&gt;();</p>
  </blockquote>
  
  <p>Based on the text above and after the split, the <strong>myList</strong> list should contain 5 objects of type CustomDictionary.</p>
  
  <pre><code> object1.Key = AD
   object1.Value = Demo
  
   object2.Key = OU
   object2.Value = WEB
  
   object3.Key = OU
   object3.Value = IT
  
   object4.Key = L
   object4.Value = MyCity
  
   object5.Key = C
   object5.Value = MyCountry
  </code></pre>
  
  <p>Here is the CustomObject class</p>
  
  <pre><code> public class CustomDictionary
   {
       public string Key { get; set; }
       public string Value { get; set; }
  
       public CustomDictionary(string key, string value)
       {
           this.Key = key;
           this.Value = value;
       }
   }
  </code></pre>
  
  <p>So far I tried this:</p>
  
  <p>Here I am stuck!</p>
  
  <pre><code>  List&lt;CustomDictionary&gt; keyVal = new List&lt;CustomDictionary&gt;val.Split(',').Select(x=&gt;x.Split('=')).Select(x=&gt;x.));
  </code></pre>
  
  <p>where <strong>val</strong> is the actual string ...</p>