ASP.net : Object Oriented implementation using List(collection-C#) to create Marks List

This Example  describe the  way to design  object oriented (class with property) program to generate the  Marks-List

Here is  output…

mtv-3

1 .Create Class under App_Code  folder (VS)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

public class students
{
    private String name;
    private int m1, m2;
    public String Name
    {
        get  {    return this.name; }
        set  {   this.name = value; }
    }
    public int Marks1
    {
        get{return this.m1;}
        set{this.m1 = value; }
    }
    public int Marks2
    {
        get { return this.m2; }
        set { this.m2 = value; }
    }
    public int Total
    {
        get { return this.m2+ this.m1; }
    
    }
    public bool PassOrFail
    {
        get {
           double p = this.Total / 2;
           return p >= 60 ? true : false;  
         }
    }
    public String Grade
    {
        get
        {
            double p = this.Total / 2;
            String s=(p>=80)?"A":(p>=70)?"B":(p>=60)?"C":"F";
            return s;
        }
    }
}

2. Create a Web form to show  the list

<%@ Page Language="C#" %>
<!DOCTYPE html>
<script  runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        students s = new students();
        s.Name = "Shailesh Dwivedi";
        s.Marks1 = 96;
        s.Marks2 = 97;
        List<students> list = new List<students>();
        list.Add(s);
        list.Add(new students { Name="Shekhar", Marks1=23, Marks2=12  });
        list.Add(new students {  Name=" Neha Yadav", Marks1=56, Marks2=90 });
        list.Add(new students {  Name=" Aradhana Tripathi", Marks1=76, Marks2=45});
        list.Add(new students { Name = "Shyam Takliwala", Marks1 = 17, Marks2 = 35 });
        list.Add(new students { Name = "Irshad  Punawala", Marks1 = 79, Marks2 = 95});
     
        GridView1.DataSource = list;
        GridView1.DataBind();

        
    }

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server"  HeaderStyle-BackColor="Orange">
        </asp:GridView>
   
    </div>
    </form>
</body>
</html>