首先,我们定交一个枚举类型

public Enum Student

{

小明=1,

小白=2,

小丽=3

}

1.根据值取内容,例根据"1"取出内容"小明"来:string text=Enum.GetName(typeof(Student), "1");

2.根据内容取值,例根据"小明"取出值"1"来:string value= (Student)Enum.Parse(typeof(Student), "小明", true);

相关文章:

  • 2022-01-21
  • 2021-09-08
  • 2022-02-26
  • 2021-09-27
  • 2022-12-23
  • 2021-08-31
  • 2022-12-23
猜你喜欢
  • 2021-07-22
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
相关资源
相似解决方案