我已經宣佈下列枚舉枚舉名稱:獲取基於枚舉值
public enum AfpRecordId
{
BRG = 0xD3A8C6,
ERG = 0xD3A9C6
}
,我要檢索的枚舉對象從是值:
private AfpRecordId GetAfpRecordId(byte[] data)
{
...
}
呼叫例子:
byte[] tempData = new byte { 0xD3, 0xA8, 0xC6 };
AfpRecordId tempId = GetAfpRecordId(tempData);
//tempId should be equals to AfpRecordId.BRG
我也想使用linq或lambda,只要它們能夠提供更好或相等的性能。
可能重複的[獲取枚舉名稱,當值已知](http://stackoverflow.com/questions/3327883/get-enum-name-when-value-is-known) – Heinzi