开发者

What is the search keyword for 'two enum members ORed together' usage?

开发者 https://www.devze.com 2023-01-21 16:39 出处:网络
what kind of usage? i don\'t know it\'s custom name. what can i write on google to search below kind of codes...开发者_开发技巧

what kind of usage? i don't know it's custom name. what can i write on google to search below kind of codes...开发者_开发技巧

service.TraceFlags = TraceFlags.EwsRequest | TraceFlags.EwsResponse;


You use it as Flags. You should tag the enum declaration of the enum with the [Flags] Attribute. And use powers of two as the named values, so binary and and binary allow you to manipulate the bitflags.

[Flags]
enum MyEnum
{
  None=0,
  A=1,
  B=2,
  C=4,
  D=8
}

http://msdn.microsoft.com/en-us/library/system.flagsattribute(VS.71).aspx
http://msdn.microsoft.com/en-us/library/ms229062.aspx

Or if misunderstood your question and you just wanted to know what flags there are in TraceFlags then just use Go to definition in visual studio.


You can specify a single trace flag, or you can specify multiple trace flags by combining them with a logical OR.

And this is a logical OR combination you are demonstrating here.

0

精彩评论

暂无评论...
验证码 换一张
取 消