I currently have a piece of code that looks like this:
switch (objectname)
{
case "objectbla":
DoSomething(1, objectName, someOtherVar);
break;
case "objectblabla":
DoSomething(2, objectName, someOtherVar);
break;
case "objectetc":
DoSomething(3, objectName, someOtherVar);
break;
case "objectanother":
DoSomething(4, objectName, someOtherVar);
break;
case "objectobj":
DoSomething(5, objectName, someOtherVar);
break;
default:
break;
}
Now, seeing how repetitive this switch is with only the first parameter counting up once, I'm sure this could be written more efficiently. I'm not sure, though. What would be a better way to write this?