相关疑难解决方法(0)

来自string,int等的枚举

使用扩展方法,我们可以创建方法通过创建扩展方法来枚举转换为其它数据类型(如String),INT ToInt(),ToString()等的枚举.

我想知道如何实现其他方式,例如FromInt(int),FromString(string)等等.据我所知,我无法创建MyEnum.FromInt()(静态)扩展方法.那么有什么可能的方法呢?

.net c# extension-methods enums type-conversion

26
推荐指数
3
解决办法
3万
查看次数

标签 统计

.net ×1

c# ×1

enums ×1

extension-methods ×1

type-conversion ×1