You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Notifies <see cref="IBufferWriter{T}"/> that <paramref name="count"/> amount of data was written to the output <see cref="Span{T}"/>/<see cref="Memory{T}"/>
430
+
/// </summary>
431
+
/// <exception cref="ArgumentException">
432
+
/// Thrown when <paramref name="count"/> is negative.
433
+
/// </exception>
434
+
/// <exception cref="InvalidOperationException">
435
+
/// Thrown when attempting to advance past the end of the underlying buffer.
436
+
/// </exception>
437
+
/// <remarks>
438
+
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
439
+
/// </remarks>
428
440
publicvoidAdvance(intcount)
429
441
{
430
442
if(count<0)
@@ -436,13 +448,41 @@ public void Advance(int count)
436
448
m_len+=count;
437
449
}
438
450
451
+
/// <summary>
452
+
/// Returns a <see cref="Memory{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
453
+
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <c>0</c>), some buffer of minimum length 16 is returned.
454
+
/// </summary>
455
+
/// <exception cref="ArgumentException">
456
+
/// Thrown when <paramref name="sizeHint"/> is negative.
457
+
/// </exception>
458
+
/// <remarks>
459
+
/// This will never return an empty <see cref="Memory{T}"/>.
460
+
/// <para />
461
+
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
462
+
/// <para />
463
+
/// You must request a new buffer after calling <see cref="Advance"/> to continue writing more data and cannot write to a previously acquired buffer.
464
+
/// </remarks>
439
465
publicMemory<char>GetMemory(intsizeHint=0)
440
466
{
441
467
CheckAndResizeBufferForBufferWriter(sizeHint);
442
468
Debug.Assert(m_buf.Length>m_len);
443
469
returnm_buf.AsMemory(m_len);
444
470
}
445
471
472
+
/// <summary>
473
+
/// Returns a <see cref="Span{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
474
+
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <c>0</c>), some buffer of minimum length 16 is returned.
475
+
/// </summary>
476
+
/// <exception cref="ArgumentException">
477
+
/// Thrown when <paramref name="sizeHint"/> is negative.
478
+
/// </exception>
479
+
/// <remarks>
480
+
/// This will never return an empty <see cref="Span{T}"/>.
481
+
/// <para />
482
+
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
483
+
/// <para />
484
+
/// You must request a new buffer after calling <see cref="Advance"/> to continue writing more data and cannot write to a previously acquired buffer.
0 commit comments