C#C
C#3y ago
0_00

how to set enum type based on what child class is used

I have the public enum
public enum WorkerType{
    Worker,
    Associate,
    Supervisor
}

and I'm making a method to set the enum based on which child class is called. So if class1 is called it will set the enum to worker, if class2 (child of class 1 with inherited variables) it sets to associate etc. I want to set my method up like
public void setWorkerType(){
    if (class = class1){
      this.WorkerType = WorkerType.Worker
}

but my issue is that im not sure how to set up my if statement so that the class is checked is class1 or not.
Was this page helpful?