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