Example #1
0
 /// <summary>
 /// Writes a <paramref name="value"/> of type <typeparamref name="T"/> into <paramref name="destination"/> and then 'advances'.
 /// </summary>
 /// <exception cref="IndexOutOfRangeException">Thrown if the <paramref name="value"/> does not fit into the <paramref name="destination"/>.</exception>
 public static void Write <T>(this IHFormat format, ref Span <byte> destination, T value)
     where T : struct
 {
     format.Write(destination, value, out int bytesWritten);
     destination = destination.Slice(bytesWritten);
 }