Say I have an enum which is just 說我有一個枚舉 this
public enum Blah { A, B, C, D }
and I would like to find the enum value of a string, for example "A"
which would be Blah.A
. 我想找到一個字符串的枚舉值,例如"A"
就是Blah.A
How would it be possible to do this? 怎麼可能作到這一點? spa
Is the Enum.valueOf()
the method I need? Enum.valueOf()
是我須要的方法嗎? If so, how would I use this? 若是是這樣,我將如何使用它? .net