[C#] int를 byte로 변환 후 Little Endian으로 변경

JEONGKI'S Note·2023년 2월 22일
0
int value = 1234;
byte[] bytes = BitConverter.GetBytes((short)value);

if (BitConverter.IsLittleEndian == false)
{
    Array.Reverse(bytes);
}

// Print the bytes in hexadecimal format
Console.WriteLine(BitConverter.ToString(bytes));
profile
주니어 개발자 공부노트입니다 :)

0개의 댓글