You could use
Enum.GetValues
:
var enumValues = Enum.GetValues(typeof(returnCodes));
foreach (object enumValue in enumValues)
{
if((returnCodes)enumValue == _receivedFrame.Data[2])
{
}
}
Alternately, you could load a
Dictionary
in the static constructor and just look up the string to return.