Big-Endian Processing in .Net Core

Is there BitConverter

or another class that supports the .NET core that I can read integers and other values ​​as Big Endian encoded?

I don't like writing a bunch of helper methods:

int GetBigEndianIntegerFromByteArray(byte[] data, int startIndex) {
    return (data[startIndex] << 24)
         | (data[startIndex + 1] << 16)
         | (data[startIndex + 2] << 8)
         | data[startIndex + 3];
}

      

+3
asp.net-core .net-core


source to share


1 answer


BitConverter

class c ToInt32()

exists in the System.Runtime.Extensions package .



0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics