How do you convert an integer to two bytes in C#?

Complete

OSNN Addict
Joined
25 Aug 2005
Messages
94
How do you convert an integer to two bytes in C#? I have googled around but no answer really works. At least none I found.
 
S

stevejustine

Guest
Shift the loword or highword of you int by 2 bytes and then use an implicit cast to truncate the part you don't need.
Or instead of casting just use a bitwise and.



Web Design
 

Members online

No members online now.

Latest profile posts

Xie Electronic Punk Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. 🙁

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk Sazar Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.
Terrahertz Electronic Punk Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk Sazar Electronic Punk wrote on Sazar's profile.
Where are you buddy?

Forum statistics

Threads
62,017
Messages
673,508
Members
5,636
Latest member
GLOCKTOR642
Back