title: Check to see if value exists in list - better way than a loop?
body: <p>I have the following class data structure:</p>
  
  <pre><code>public class clsUser
  {
      public string userid { get; set; }
      public List&lt;OrgPermission&gt; orgs { get; set; }
  }
  
  public class OrgPermission
  {
      public string Org { get; set; }
      public string SubOrg {get;set;}
      public List&lt;string&gt; type { get; set; }
  }
  </code></pre>
  
  <p><code>List&lt;string&gt; type</code> can have values such as "admin", "user", "superuser", etc.</p>
  
  <p>so each user can have multiple org-suborg combinations with multiple user roles to each.</p>
  
  <p>orgs and suborgs in the user class can be written out like so: 56% (which means they can see everything that starts with 56)</p>
  
  <p>I want to check if the user has access to org-suborg combination on a page of type "Admin"</p>
  
  <p>right now I am doing it with a loop, which works, like so:</p>
  
  <pre><code>foreach (OrgPermission userOrg in user.orgs) {
    if ((ddlOrg.SelectedValue.StartsWith(userOrg.Org.Trim('%'))) &amp;&amp; (ddlSubOrg.SelectedValue.StartsWith(userOrg.SubOrg.Trim('%')))) {
      if (userOrg.type.Contains("Admin"))
        btnSubmitToProd.Enabled = true;
      else
        btnSubmitToProd.Enabled = false;
      break; //break out of the loop if the org-sub org match is found
    }
  }
  </code></pre>
  
  <p>is there a better way to do this to get rid of the loop maybe? or am I doing it right?</p>