METHOD
BinaryPrimitives.ReadInt32BigEndian
Reads the first four bytes as a signed 32-bit big-endian value regardless of host byte order. Requires at least four bytes. This is a byte-format operation, not a marshaling or alignment guarantee.
Formal Syntax & Structure
csharp syntaxcsharp
BinaryPrimitives.ReadInt32BigEndian(bytes)Working Example
Example Snippetcsharp
using System;using System.IO;using System.Collections.Generic;using System.Buffers;using System.Buffers.Binary;using System.Runtime.CompilerServices;using System.Threading;Console.WriteLine(BinaryPrimitives.ReadInt32BigEndian(new byte[]{0,0,0,42})); // 42