Wydajny sposób na odczytanie danych big endian w C #

Używam następującego kodu do czytania informacji BigEndian za pomocąBinaryReader ale nie jestem pewien, czy jest to skuteczny sposób. Czy jest jakieś lepsze rozwiązanie?

Oto mój kod:

// some code to initialize the stream value
// set the length value to the Int32 size
BinaryReader reader =new BinaryReader(stream);
byte[] bytes = reader.ReadBytes(length);
Array.Reverse(bytes);
int result = System.BitConverter.ToInt32(temp, 0);

questionAnswers(2)

yourAnswerToTheQuestion