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

Discussion in 'Web Design & Coding' started by Complete, Oct 13, 2010.

  1. Complete

    Complete OSNN Addict

    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.
     
  2. stevejustine

    stevejustine OSNN One Post Wonder

    Messages:
    3
    Location:
    Ahmedabad
    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