redis数据同步到mysql 如何遍历枚举类型的对象,并获取枚举类型长度?

如何遍历枚举类型的对象,并获取枚举类型长度?publicenumtestenum{aa,bb,cc,dd}foreach(中的testenum项)枚举.GetValue(typeof(testenum

如何遍历枚举类型的对象,并获取枚举类型长度?

publicenumtestenum{aa,bb,cc,dd}foreach(中的testenum项)枚举.GetValue(typeof(testenum)){}枚举.GetValue(typeof(枚举的名称))获取指定枚举的枚举值。枚举.GetNames(typeof(枚举名称))获取指定枚举的枚举名称。