I have a huge if else statement where an Object is getting check for a specific type bevor it is used in a method. Is there a shorter/more effective way of doing this?
A bit simplified my code looks like this:
if(object is class1) someMethod(object as class1);
else if (object is class2) someMethod(object as class2);
else if (object is class3) someMethod(object as class3);
else if (object is class4) someMethod(object as class4);
else if (object is class5) someMethod(object as class5);
.
.
.
Aucun commentaire:
Enregistrer un commentaire