假设有一个枚举:
Public Enum MyEnum
Value1 = 100
Value2 = 200
Value3 = 300
End Enum
如何实现扩展方法以获取此枚举的所有值的整数数组?
Dim ints As Integer() = GetType(MyEnum).ToIntArray()
' result: ints = {100, 200, 300}
(我已经看到扩展方法必须基于类型。)
假设有一个枚举:
Public Enum MyEnum
Value1 = 100
Value2 = 200
Value3 = 300
End Enum
如何实现扩展方法以获取此枚举的所有值的整数数组?
Dim ints As Integer() = GetType(MyEnum).ToIntArray()
' result: ints = {100, 200, 300}
(我已经看到扩展方法必须基于类型。)