由其他成员组成的Enum(标志)成员 [英] Enum (flags) member composed of other members
本文介绍了由其他成员组成的Enum(标志)成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
[<Flags>]
type LikeMatch =
| None = 0
| Start = 1
| End = 2
| All = Start ||| End //ERROR: Unexpected identifier in union case
我也尝试过用枚举类型对成员进行限定.有没有办法在F#中做到这一点?
I've also tried qualifying the members with the enum type. Is there a way to do this in F#?
推荐答案
根据F#语言参考,无法执行此操作. F#枚举中=符号的右侧必须是整数文字
According to the F# language reference there is no way to do this. The right hand side of the = sign in a F# enum must be an integer literal
语法
type enum-name =
| value1 = integer-literal1
| value2 = integer-literal2
这篇关于由其他成员组成的Enum(标志)成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文