コード例 #1
0

        
コード例 #2
0
ファイル: Form1.cs プロジェクト: jcsmei/Enumerated-Types
        private void btnEnumVariables_Click(object sender, EventArgs e)
        {
            //here is how to declare a enum variable
            emPloyeeType workRole = emPloyeeType.maintenance;
            Employee     newHireA = new Employee("John", workRole);
            //without the ENUM VARIABLE, Employee can be instantiated too;
            Employee HireA = new Employee("John", emPloyeeType.maintenance);

            rtbDisplay.Text = newHireA.Name + " worked in the area of " + newHireA.TypeOfWork + ".";
            //an employee could be reassigned a role
            workRole            = emPloyeeType.management;
            newHireA.TypeOfWork = workRole;
            rtbDisplay.Text    += @"
He now works at " + newHireA.TypeOfWork;
        }
コード例 #3
0
 public Employee(string n, emPloyeeType t)
 {
     Name       = n;
     TypeOfWork = t;
 }