组合枚举的多个标志?

Combining multiple flags of an enum?

我一直在尝试为 SpeechLibs Talk() 函数使用多个标志。 这就是我想要做的:

V.Speak ("Text", SpeechVoiceSpeakFlags.SVSFlagsAsync + SpeechVoiceSpeakFlags.SVSFIsXML);

但是,它给了我以下错误:

Error 1 Operator '+' cannot be applied to operands of type 'SpeechLib.SpeechVoiceSpeakFlags' and 'SpeechLib.SpeechVoiceSpeakFlags' c:\users\max\documents\visual studio 2013\projects\switch\switch\default_tts_screen.cs 62 51 Switch

虽然文档明确指出这应该是可能的:

Example
The following code snippet demonstrates the Speak method with several   commonly used flag settings.
[...]
V.Speak "text with XML", SVSFIsXML + SVSFlagsAsync
[...]

请注意,我使用的是 C#,但这不会改变任何内容。正确的?.. 请帮助我解决这个问题,因为几个小时以来它已经让我的头撞到我的 table 了。 我还没有在网上找到解决方案。

您将枚举标志与按位或运算符组合如下:

V.Speak ("Text", SpeechVoiceSpeakFlags.SVSFlagsAsync | SpeechVoiceSpeakFlags.SVSFIsXML);