title: Adding a list to a dictionary
body: <p>In my program I have a list of marks and a dictionary which stores the studentId. I want that the user enters the studentId and according to that id it will point to the list of marks. I think I am implementing it incorrectly. Can someone help me in implementing it. Thanks</p>
  
  <pre><code> public class Student() {
          private string name;
          private string surname;
          private string dob;
          private string address;
          private int id;
  
          public Student()
          {
          }
          public Student(string year,string name, string surname, string dob, string address)
          {
              this.name = name;
              this.surname = surname;
              this.dob = dob;
              this.address = address;
              this.year = year;
          }
  
  
        public string Name
          {
              get { return name; }
              set { name = value; }
          }
  
          public string Surname
          {
              get { return surname; }
              set { surname = value; }
  
          }
  
          public string DOB
          {
              get { return dob; }
              set { dob = value; }
          }
  
          public string Addr
          {
              get { return address; }
              set { address = value; }
  
          }
          public int Id
          {
              get { return id; }
              set { id = value; }
          }
  
  
          private string year;
  
          public string Year
          {
              get { return year; }
              set { year = value; }
  
          }
           public Student(string s)
          {
              string[] splitted = s.Split(',');
              name = splitted[0];
              surname = splitted[1];
              dob = splitted[2];
              address = splitted[3];
             // id = splitted[4];          
           }
          public Dictionary&lt;int,List&lt;Marks&gt;&gt; dictionary= new Dictionary&lt;int,List&lt;Marks&gt;&gt;();
          public List&lt;Marks&gt; Mathematics = new List&lt;Marks&gt;();
          public List&lt;Marks&gt; English = new List&lt;Marks&gt;();
          public List&lt;Marks&gt; Maltese = new List&lt;Marks&gt;();
          public List&lt;Marks&gt; ReligiousStudies = new List&lt;Marks&gt;();
          public List&lt;Marks&gt; SocialStudies = new List&lt;Marks&gt;();
          public Dictionary&lt;int, List&lt;Marks&gt;&gt; dictionar = new Dictionary&lt;int, List&lt;Marks&gt;&gt;();
  
  
          public void AddMarks(int hyexam, int anexam)
          {
              {
                  Console.WriteLine("enter id of student to input marks to:");
                  string id = Console.ReadLine();
                  if (dictionar.ContainsKey(Id).Equals(id))
                  {
                      Mathematics.Add(new Marks(hyexam, anexam));
                      English.Add(new Marks(hyexam, anexam));
                      Maltese.Add(new Marks(hyexam, anexam));
                      ReligiousStudies.Add(new Marks(hyexam, anexam));
                      SocialStudies.Add(new Marks(hyexam, anexam));
                      dictionar.Add(id, (Mathematics)); //dont know how to implement it
                  }
                  else
                  {
                      Console.WriteLine("id not found");
                  }
  
              }
          }
  
     public class Marks
      {
          private int hyexam;
          private int anexam;
          private string id;
          public int HYEXAM
          {
              get { return hyexam; }
              set { hyexam = value; }
          }
  
          public int ANEXAM
          {
              get { return anexam; }
              set { anexam = value; }
          }
  
          public string Id
          {
              get { return id; }
              set { id = value; }
          }
  
          public Marks(int hyexam, int anexam)
          {          
              this.hyexam = hyexam;
              this.anexam = anexam;
          }
          public Marks(string id)
          {
              this.id = id;
          }
  
          public double OverallExam()
          {
              return (0.4 * hyexam) + (0.6 * anexam);
          }
  
      }
  }
  </code></pre>