c# - Using bitwise operators -


I am studying C # and running on land familiar to my old work in C ++. I never understood the cause of bitwise operators in a real application. I have never used them and they never had the reason to use it. I am reading how they work; The example shift below shows the bitwise operator. What does Bitwise operators mean, their use and how they work?

Maybe I'm missing something in some wrong logic.

  byte bit comp = 15; // bitcomp = 15 = 00001111b byte bracelt = (byte) ~ bitComp; // bresult = 240 = 11110000b  

Here is an example for a complementary bitwise operator:

  byte bit comp = 15; // bitcomp = 15 = 00001111b byte bracelt = (byte) ~ bitComp; // bresult = 240 = 11110000b  

Add a specific use bits that represent mutually exclusive 'flag'.

Example from MSDN:

day code 2 {none = 0x0, Sunday = 0x1, Monday = 0x2, Tuesday = 0x4, Wednesday = 0x8, Thursday = 0x10, Friday = 0x20, Saturday = 0x40} Class Mylanes {day 2 meeting day = day 2. todewar | Days2.Thursday; Day 2 No VideoNews = ~ (Day 2. Wednesday); }

Stack & nbsp; Also see overflow question


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -