如何枚举枚举/类型的F#类型

由网友(时光老去)分享简介:我有像这样定义枚举类型:键入标签=| ART = 0| N = 1| V = 2| P = 3| NULL = 4有没有办法做一个的...在标签做?这是我收到的错误:的值,构造函数,命名空间或键入标签没有定义解决方案 使用的 Enum.GetValues​​ :让allTags = Enum.GetValues​​...

我有像这样定义枚举类型:

 键入标签=
    | ART = 0
    | N = 1
    | V = 2
    | P = 3
    | NULL = 4
 

有没有办法做一个的...在标签做

这是我收到的错误:

  C enum枚举类型

的值,构造函数,命名空间或   键入标签没有定义

解决方案

使用的 Enum.GetValues​​

 让allTags = Enum.GetValues​​(typeof运算<标签>)
 

I've got an enumeration type defined like so:

type tags = 
    | ART  = 0
    | N    = 1
    | V    = 2 
    | P    = 3
    | NULL = 4

is there a way to do a for ... in tags do ?

This is the error that I'm getting:

The value, constructor, namespace or type tags is not defined

解决方案

Use Enum.GetValues:

let allTags = Enum.GetValues(typeof<tags>)

阅读全文

相关推荐

最新文章