title: Iterate through object properties and update if condition is met
body: <p>Currently I have a list, and I iterate through it, and If a condition is met I clear the data (see foreach please).</p>
  
  <p><strong>Current code but not really what I want, I want to use strongly typed</strong></p>
  
  <pre><code>public class ViewCommonItemVM
  {
      public string Name { get; set; }
      public List&lt;string&gt; Data { get; set; }
      public string Bullet { get; set; }
  
      public ViewCommonItemVM()
      {
          Data = new List&lt;string&gt;();
      }
  }
  
  
  List&lt;ViewCommonItemVM&gt; commons = new List&lt;ViewCommonItemVM&gt;();
  
  commons.Add( new ViewCommonItemVM { Name = "Projects", Data = someListHere });
  commons.Add( new ViewCommonItemVM { Name = "Companies", Data = someListHere });
  commons.Add( new ViewCommonItemVM { Name = "Schools", Data = someListHere });
  commons.Add( new ViewCommonItemVM { Name = "Hobbies", Data = someListHere });
  commons.Add( new ViewCommonItemVM { Name = "Locations", Data = someListHere });
  commons.Add( new ViewCommonItemVM { Name = "Interests", Data = someListHere });
  commons.Add( new ViewCommonItemVM { Name = "Stuff", Data = someListHere });
  commons.Add( new ViewCommonItemVM { Name = "Things", Data = someListHere });
  commons.Add( new ViewCommonItemVM { Name = "Somelist", Data = someListHere });
  
  foreach (var common in commons.Where(c =&gt; c.Data.Count != 0))
  {
      count++;
      if (count &gt; 4 &amp;&amp; common.Data.Count != 0)
          common.Data.Clear();
  }
  </code></pre>
  
  <p>But I want to benefit from the stronly typed, so</p>
  
  <p><strong>Want to do</strong></p>
  
  <p>Object</p>
  
  <pre><code>public class ViewCommonVm
  {
      public ViewCommonItemVM Projects {get;set;}
      public ViewCommonItemVM Companies {get;set;}
      public ViewCommonItemVM Schools {get;set;}
      public ViewCommonItemVM Hobbies {get;set;}
      public ViewCommonItemVM Locations {get;set;}
      public ViewCommonItemVM Interests {get;set;}
      public ViewCommonItemVM Stuff {get;set;}
      public ViewCommonItemVM Things {get;set;}
      public ViewCommonItemVM Somelist {get;set;}
  }
  
  public class ViewCommonItemVM
  {
      public string Name { get; set; }
      public List&lt;string&gt; Data { get; set; }
      public string Bullet { get; set; }
  }
  
  
  // Here it should iterated trough the object, and after 
  // 4 lenght properties != 0, clear the property list
  </code></pre>
  
  <p>How can I achieve this?</p>