.net – How to enumerate an enum/type in F#

%fenumsnet

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

Best Answer

Use Enum.GetValues:

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