views:

891

answers:

4

How do I bitwise shift right/left in VB.NET? Does it even have operators for this, or do I have to use some utility method?

+4  A: 

VB.NET has had bit shift operators (<<, >>) since 2003.

Mehrdad Afshari
+1  A: 

It's right there mate, just down on the list from the link you posted!

Noon Silk
Yea, just found it myself!
Jenko
A: 

Oh I found it, you can use the << and >> operators, and you have to specify how many bits to shift.

myFinal = myInteger << 4   // shift LEFT by 4 bits
myFinal = myInteger >> 4   // shift RIGHT by 4 bits
Jenko
A: 

the article at http://visualbasic.about.com/od/usingvbnet/a/bitops01.htm should be useful.

Tzury Bar Yochay