title: How to convert in asp.net mvc string into int with LINQ?
body: <p>How can I convert string to integer using LINQ?</p>
  
  <p>See below for what I have tried so far.</p>
  
  <pre><code>public ActionResult ViewStudent()
  {
  var std = from s in db.Students
            select new StudentViewModel()
            {
               student_id = s.student_id,
               student_name = s.student_name,
               student_age =s.student_age,
               student_address = s.student_address
             };
  
      var age = std.Average(s =&gt; Convert.ToInt32(s.student_age));//error 
      var nostd = std.Count();
      ViewBag.totalstd = nostd;
      ViewBag.stdage = age;
  
      return View(std);
  }
  </code></pre>