Cryptography/CafeLib.Cryptography.UnitTests/BsvSharp/Extensions/NumericsExtensions.cs
/// <summary>
/// Returns access to an integer as a span of bytes.
/// Reflects the endian of the underlying implementation.
/// </summary>
/// <param name="i"></param>
/// <param name="bigEndian"></param>
/// <returns></returns>
Returns access to an integer as a span of bytes.
Reflects the endian of the underlying implementation.
Returns access to an integer as a span of bytes . Reflects the endian of the underlying implementation .
public static ReadOnlyByteSpan AsReadOnlySpan(this int i, bool bigEndian = false)
        {
            var bytes = BitConverter.GetBytes(i);
            if (BitConverter.IsLittleEndian == bigEndian)
            {
                Array.Reverse(bytes);
            }
            return bytes;
        }
public static ReadOnlyByteSpan AsReadOnlySpan ( this int i , bool bigEndian = false ) { var bytes = BitConverter . GetBytes ( i ) ; if ( BitConverter . IsLittleEndian == bigEndian ) { Array . Reverse ( bytes ) ; } return bytes ; }
Returns access to an integer as a span of bytes.
Returns access to an integer as a span of bytes .
None
int
this
bigEndian
bool
None
i
None