title: Linq to find inside Array of objects
body: <p>I have the below code . Here i want to find out servicelevelid in lstServiceLevels List which is an array of objects of ServiceLevelDetails where ServiceLevelName is "Basic"</p>
  
  <p>Could anyone please help me to get it ? </p>
  
  <pre><code>public class ServiceLevelDetails
  {
      public int servicelevelid;
      public string ServiceLevelName;
  }
  
  class Program
  {
      static void Main(string[] args)
      {
          IList&lt;ServiceLevelDetails&gt; lstServiceLevels = new List&lt;ServiceLevelDetails&gt;();
          ServiceLevelDetails one = new ServiceLevelDetails();
          one.servicelevelid=1;
          one.ServiceLevelName="Basic";
  
          ServiceLevelDetails Two = new ServiceLevelDetails();
          Two.servicelevelid = 2;
          Two.ServiceLevelName = "Enhanced";  
  
          lstServiceLevels.Add(one);
          lstServiceLevels.Add(Two);
  
          var test = from LevelName in lstServiceLevels 
                     let LevelName= obj as ServiceLevelDetails 
                     where LevelName.ServiceLevelName == "Basic" 
                     select LevelName;
          //getting error in the above code .  
      }
  }
  </code></pre>