title: C# link two properties together?
body: <p>I am trying to retrieve a List of Modules for a student and add them to a property in another class in order to display them. The aim I have is, when I create an instance of a person and their Programme has a certain name, it will retrieve the modules for that programme.</p>
  
  <p>This is my method in my Programme class where I try to get the modules from the ListOfModules Method in the Modules class.</p>
  
  <pre><code>    public List&lt;Modules&gt; ModuleList
      {
          get
          {
              Modules m = new Modules();
  
              if (m.ListOfModules == null)
              {
                  return null;
              }
              else
              {
                  return m.ListOfModules;
              }
          }
      }
  </code></pre>
  
  <p>This is the ListOfModules method in the Modules Class.</p>
  
  <pre><code>internal List&lt;Modules&gt; ListOfModules
      {
          get 
          {
              if (_modules == null)
              {
                  return _modules;
              }
              else
              {
                  return _modules;
              }
          }
      }
  </code></pre>
  
  <p>and here is an example of how I add modules to a list of modules. </p>
  
  <pre><code>class CGP : Programmes
  {
      List&lt;Modules&gt; modules;
      public CGP() :base("CGP") //CGP is the name of the programme
      {
          modules = new List&lt;Modules&gt;();
          modules.Add(new Modules("example 1"));
          modules.Add(new Modules("example 2"));
      }
  }
  </code></pre>
  
  <p>So how can I go about getting the ModuleList method in the Programme class to get this list of modules from the ListOfModules method in the Modules class? I know that these modules are being added to the ListOfModules method but they I cant seem to work out how to link it with the ModuleList so I can print out that list.</p>
  
  <p>I will appreciate any help or support as I have spent countless amount of hours trying to figure this out. Sorry for sounding like an amateur. </p>