Skip to content

Adding missing System.Buffers documentation #90891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public static Half ReadHalfBigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="short" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 2 bytes from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="short" />.
/// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static short ReadInt16BigEndian(ReadOnlySpan<byte> source)
{
Expand All @@ -56,6 +62,12 @@ public static short ReadInt16BigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="int" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 4 bytes from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="int" />.
/// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ReadInt32BigEndian(ReadOnlySpan<byte> source)
{
Expand All @@ -67,6 +79,12 @@ public static int ReadInt32BigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="long" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 8 bytes from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="long" />.
/// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static long ReadInt64BigEndian(ReadOnlySpan<byte> source)
{
Expand All @@ -78,6 +96,12 @@ public static long ReadInt64BigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="Int128" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 16 bytes from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="Int128" />.
/// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Int128 ReadInt128BigEndian(ReadOnlySpan<byte> source)
{
Expand All @@ -89,6 +113,12 @@ public static Int128 ReadInt128BigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="nint" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="nint" />.
/// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static nint ReadIntPtrBigEndian(ReadOnlySpan<byte> source)
{
Expand Down Expand Up @@ -117,6 +147,12 @@ public static float ReadSingleBigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="ushort" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 2 bytes from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="ushort" />.
/// </exception>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ushort ReadUInt16BigEndian(ReadOnlySpan<byte> source)
Expand All @@ -129,6 +165,12 @@ public static ushort ReadUInt16BigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="uint" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 4 bytes from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="uint" />.
/// </exception>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint ReadUInt32BigEndian(ReadOnlySpan<byte> source)
Expand All @@ -141,6 +183,12 @@ public static uint ReadUInt32BigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="ulong" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 8 bytes from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="ulong" />.
/// </exception>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ulong ReadUInt64BigEndian(ReadOnlySpan<byte> source)
Expand All @@ -153,6 +201,12 @@ public static ulong ReadUInt64BigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="UInt128" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 16 bytes from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="UInt128" />.
/// </exception>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static UInt128 ReadUInt128BigEndian(ReadOnlySpan<byte> source)
Expand All @@ -165,6 +219,12 @@ public static UInt128 ReadUInt128BigEndian(ReadOnlySpan<byte> source)
/// <summary>
/// Reads a <see cref="nuint" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <param name="source">The read-only span to read.</param>
/// <returns>The big endian value.</returns>
/// <remarks>Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span.</remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="source"/> is too small to contain a <see cref="nuint" />.
/// </exception>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static nuint ReadUIntPtrBigEndian(ReadOnlySpan<byte> source)
Expand Down Expand Up @@ -221,7 +281,12 @@ public static bool TryReadHalfBigEndian(ReadOnlySpan<byte> source, out Half valu
/// <summary>
/// Reads a <see cref="short" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="short" />, return false.</returns>
/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="short" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 2 bytes from the beginning of the span.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadInt16BigEndian(ReadOnlySpan<byte> source, out short value)
{
Expand All @@ -238,7 +303,12 @@ public static bool TryReadInt16BigEndian(ReadOnlySpan<byte> source, out short va
/// <summary>
/// Reads a <see cref="int" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="int" />, return false.</returns>
/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="int" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 4 bytes from the beginning of the span.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadInt32BigEndian(ReadOnlySpan<byte> source, out int value)
{
Expand All @@ -255,7 +325,12 @@ public static bool TryReadInt32BigEndian(ReadOnlySpan<byte> source, out int valu
/// <summary>
/// Reads a <see cref="long" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="long" />, return false.</returns>
/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="long" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 8 bytes from the beginning of the span.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadInt64BigEndian(ReadOnlySpan<byte> source, out long value)
{
Expand All @@ -272,7 +347,12 @@ public static bool TryReadInt64BigEndian(ReadOnlySpan<byte> source, out long val
/// <summary>
/// Reads a <see cref="Int128" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="Int128" />, return false.</returns>
/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="Int128" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 16 bytes from the beginning of the span.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadInt128BigEndian(ReadOnlySpan<byte> source, out Int128 value)
{
Expand All @@ -289,7 +369,12 @@ public static bool TryReadInt128BigEndian(ReadOnlySpan<byte> source, out Int128
/// <summary>
/// Reads a <see cref="nint" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="nint" />, return false.</returns>
/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="nint" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadIntPtrBigEndian(ReadOnlySpan<byte> source, out nint value)
{
Expand Down Expand Up @@ -327,7 +412,12 @@ public static bool TryReadSingleBigEndian(ReadOnlySpan<byte> source, out float v
/// <summary>
/// Reads a <see cref="ushort" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="ushort" />, return false.</returns>
/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="ushort" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 2 bytes from the beginning of the span.</remarks>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadUInt16BigEndian(ReadOnlySpan<byte> source, out ushort value)
Expand All @@ -345,7 +435,12 @@ public static bool TryReadUInt16BigEndian(ReadOnlySpan<byte> source, out ushort
/// <summary>
/// Reads a <see cref="uint" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="uint" />, return false.</returns>
/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="uint" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 4 bytes from the beginning of the span.</remarks>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadUInt32BigEndian(ReadOnlySpan<byte> source, out uint value)
Expand All @@ -363,7 +458,12 @@ public static bool TryReadUInt32BigEndian(ReadOnlySpan<byte> source, out uint va
/// <summary>
/// Reads a <see cref="ulong" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="ulong" />, return false.</returns>
/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="ulong" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 8 bytes from the beginning of the span.</remarks>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadUInt64BigEndian(ReadOnlySpan<byte> source, out ulong value)
Expand All @@ -381,7 +481,12 @@ public static bool TryReadUInt64BigEndian(ReadOnlySpan<byte> source, out ulong v
/// <summary>
/// Reads a <see cref="UInt128" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="UInt128" />, return false.</returns>
/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="UInt128" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 16 bytes from the beginning of the span.</remarks>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadUInt128BigEndian(ReadOnlySpan<byte> source, out UInt128 value)
Expand All @@ -399,7 +504,13 @@ public static bool TryReadUInt128BigEndian(ReadOnlySpan<byte> source, out UInt12
/// <summary>
/// Reads a <see cref="nuint" /> from the beginning of a read-only span of bytes, as big endian.
/// </summary>
/// <returns>If the span is too small to contain a <see cref="nuint" />, return false.</returns>

/// <param name="source">The read-only span of bytes to read.</param>
/// <param name="value">When this method returns, the value read out of the read-only span of bytes, as big endian.</param>
/// <returns>
/// <see langword="true" /> if the span is large enough to contain a <see cref="nuint" />; otherwise, <see langword="false" />.
/// </returns>
/// <remarks>Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span.</remarks>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadUIntPtrBigEndian(ReadOnlySpan<byte> source, out nuint value)
Expand Down
Loading