c# - What does a BitWise OR ("|") mean when used with a return statement? -


in c#.net, has ever seen return statement inside method looks this?

protected override buttons getbuttonstoshow() {     return buttons.new | buttons.return | buttons.delete; } 

how bitwise operator "|" working here? result of statement? know how bitwise operators work in if ... else ... statements , such, i've never seen used way.

buttons flags enum.

this makes bit-mappable can use bitwise operators combine values.

in case returns value bitmap combining of 3 options.

this blog post has quite clear explanation (though uses & example).


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -