title: Sorting array with multiple column in C#
body: <p>C# code  </p>
  
  <p>Method</p>
  
  <pre><code>[System.Web.Services.WebMethod]
      public static SubjectList[] GetStudentList(string location, string program, long batch, string term,string code ,string name)
  {
      using (Entities obj = new Entities())
      {
          SubjectListStatus subObjStatus = new SubjectListStatus();
          List&lt;string&gt; rollno = obj.Student_Master.Where(i =&gt;i.Student_Location==location &amp;&amp; i.Student_Course==program &amp;&amp; i.Student_Batch==batch).Select(i =&gt; i.Student_RollNo).ToList();
          foreach (var rollObj in rollno)
          {
              var listLoc = obj.Marks_Master.Where(k =&gt; k.Location == location &amp;&amp; k.Course_ID == program &amp;&amp; k.Subject_ID == code &amp;&amp; k.Term_ID == term &amp;&amp; k.Student_ID.Equals(rollObj)).ToList();
              foreach (var tempobj in listLoc)
              {
                  SubjectList subObj = new SubjectList();
                  subObj.Subject_Code = tempobj.Student_ID;                   
                  subObj.Total_Obtained = tempobj.Marks_Obtained; ;
                  subObj.Total_Outoff = tempobj.Marks_Total; ;
                  subObjStatus.Add(subObj);
              }
          }
         //sort Here
          return subObjStatus.ToArray();
      }
  }
  </code></pre>
  
  <p>Class </p>
  
  <pre><code>public class SubjectList
  {
      public string Subject_Code { get; set; }
      public string Subject_Name { get; set; }      
      public long Total_Obtained { get; set; }
      public long Total_Outoff { get; set; }  
  }
  public class SubjectListStatus : List&lt;SubjectList&gt;
  {
      public void Add(SubjectList st)
      {
          base.Add(st);
      }
  
  }
  </code></pre>
  
  <p>I want to sort in descending order for column <code>Total_Obtained</code> before return data
  I tried <code>Array.Sort</code> but shows following error</p>
  
  <p><a href="https://i.stack.imgur.com/xTQ4d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xTQ4d.png" alt="enter image description here"></a></p>
  
  <p>1) how to use <code>Array.Sort</code></p>
  
  <p>2) for that any other easy way to do such sorting </p>
  
  <p>I put image for data 
  <a href="https://i.stack.imgur.com/frslI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/frslI.png" alt="enter image description here"></a></p>
  
  <p>Thanks in advance</p>