title: c# enum in constructor
body: <p>Currently I am working on a student system register for practicing C#. i am trying to add an Enum in the constructor but get the error: Enum does not contain a definition for JobPosition. I have absolutely no clue about what could be wrong and tried different things. is there someone that knows what the problem is?</p>
  <p>Code for adding a teacher:</p>
  <pre><code> //Begin adding a Teacher
          private void btnNewTeacher_Click(object sender, EventArgs e)
          {
              if (txtEc.Text == &quot;&quot; || txtAge.Text == &quot;&quot; || txtName.Text == &quot;&quot; || txtPcn.Text == &quot;&quot; || txtYearAtSchool.Text == &quot;&quot;)
              {
                  MessageBox.Show(&quot;Please fill in all the required information&quot;);
              }
              else
              {
                  //Check if pcn is used, if not add student
                  if (administrationTeacher.GetTeacher(Convert.ToInt32(txtPcn.Text)) == null
                  &amp;&amp; administrationStudent.GetStudent(Convert.ToInt32(txtPcn.Text)) == null)
                  {
                      administrationTeacher.AddTeacher(new Teacher(Enum.JobPosition.JUNIOR_Teacher,  Convert.ToInt32(txtEc.Text), Convert.ToInt32(txtAge.Text), txtName.Text, 
                          Convert.ToInt32(txtPcn.Text), Convert.ToInt32(txtYearAtSchool.Text)));
  
                  }
                  else
                  {
                      MessageBox.Show(&quot;The pcn for this student is already in use, &quot; +
                          &quot;please pick another one&quot;);
                  }
              }
          }
  </code></pre>
  <p>Code for teacher:</p>
  <pre><code>public JobPosition jobPosition { get; private set; }
          private double salary;
  
          public Teacher(JobPosition jobPosition, double salary, int age, string name, int pcn, int yearAtSchool)
              : base(age, name, pcn, yearAtSchool)
          {
              this.jobPosition = jobPosition;
              this.salary = salary;
          }
  </code></pre>
  <p>JobPosition interface code:</p>
  <pre><code>public enum JobPosition //Enum represents a group of constants.
      {
          JUNIOR_TEACHER,
          TEACHER1,
          TEACHER2,
          TEACHER3,
          COORDINATOR,
          DIRECTOR
      }
  </code></pre>