Which has better performance, Enum or Int in a switch case?

Viewed 3809

Which code snippet is better to use when considering the performance for the switch case with enum and int as the case parameter:

A.

switch ((ToolbarButton)BtnId)
{
    case ToolbarButton.SHOWPROPERTYDIALOG:
         OnShowProperties();
         break;
    case ToolbarButton.MOVETOFIRST:
         OnFirstMessage();
         break;
    case ToolbarButton.MOVETOLAST:
         OnLastMessage();
         break;
}

B.

switch (BtnId)
{
     case (int)ToolbarButton.SHOWPROPERTYDIALOG:
          OnShowProperties();
          break;
     case (int)ToolbarButton.MOVETOFIRST:
          OnFirstMessage();
          break;
     case (int)ToolbarButton.MOVETOLAST:
          OnLastMessage();
          break;
}
2 Answers
Related