title: Parsing JSON with C# and adding results to winform combobox
body: <p>I am trying to create a WinForm application that parses a json file to populate a combobox.</p>
  
  <p>The JSON looks like this:</p>
  
  <pre><code>{"Id":0,"Name":"default","Option":"default","Description":"default","OtherDescription":"default"}
  </code></pre>
  
  <p>I've created a class called Incident having properties that will be filled with the json information:</p>
  
  <pre><code>    public class Incident
  {
      public Incident(int id, string name, string option, string description, string otherDescription)
      {
          Id = id;
          Name = name;
          Option = option;
          Description = description;
          OtherDescription = otherDescription;
      }
  
      public int Id { get; set; }
      public string Name { get; set; }
      public string Option { get; set; }
      public string Description { get; set; }
      public string OtherDescription { get; set; }
  }
  </code></pre>
  
  <p>And a list a class IncidentsList:</p>
  
  <pre><code>    public class IncidentsList
  {
      public List&lt;Incident&gt; Incidents = new List&lt;Incident&gt;();
  
  }
  </code></pre>
  
  <p>For some reason I am unable to populate the combobox items with the name of the incident.</p>
  
  <p>Here is the entire code, any help will be highly appreciated:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
  
      }
  
      private void Form1_Load(object sender, EventArgs e)
      {
          //
          var incident = new Incident(0, "default", "default", "default", "default");
          // Convert object to Json
          var strResultJson = JsonConvert.SerializeObject(incident);
          // Write values as Json file
          File.WriteAllText(@"configuration.json", strResultJson);
          // Read values from file
          var strReadJson = File.ReadAllText(@"configuration.json");  
          // Convert to Json Object
          var x = JsonConvert.DeserializeObject&lt;IncidentsList&gt;(strReadJson);
  
          foreach (var option in x.Incidents.Select(p =&gt; p.Name))
          {
              comboBox1.Items.Add(option);
          }
  
      }
  
  }
  
  public class Incident
  {
      public Incident(int id, string name, string option, string description, string otherDescription)
      {
          Id = id;
          Name = name;
          Option = option;
          Description = description;
          OtherDescription = otherDescription;
      }
  
      public int Id { get; set; }
      public string Name { get; set; }
      public string Option { get; set; }
      public string Description { get; set; }
      public string OtherDescription { get; set; }
  }
  
  public class IncidentsList
  {
      public List&lt;Incident&gt; Incidents = new List&lt;Incident&gt;();
  
  }
  </code></pre>