Hi folks,
after a bit speedtracing I found a piece of code (called very very often) which converts values of one enum to values of another enum, like this:
public Enum2 ConvertToEnum2(Enum1 enum1)
{
switch(enum1)
{
case Enum1.One:
return Enum2.One;
break;
case Enum1.Two:
return Enum2.Two;
break;
}
}
Would it me more performant if I save those conversions in a Dictionary and just do something like this:
public Enum2 ConvertToEnum2(Enum1 enum1)
{
return m_ConversionTable[enum1];
}
Thanks for your comments!