我想基於字符串中的值動態設置一個枚舉到目前爲止這麼好,我不知道我一直在做錯什麼。我有以下代碼:爲什麼我的enum.Parse方法失敗?
public enum TagLabels : long
{
TurnLeft = 0x0000000000000000000030A38DB1,
TurnRight = 0x00000000000000000000307346CC,
LiftApproach = 0x0000000000000000000012107A8D
}
TagLabels ID;
string someID = "0x0000000000000000000012107A8D";
IDs = (TagLabels)Enum.Parse(typeof(TagLabels), someID); //<== I get runtime error on this line
我看不出我在做什麼錯。
該錯誤將有所幫助。 – jcollum 2009-08-13 17:08:18
對不起,我不知道包裝代碼的捷徑。 – 2009-08-13 17:09:02
返回的錯誤是:未找到請求的值'0x0000000000000000000010107A8D' – 2009-08-13 17:09:33