44/*============================================================
55**
66** Purpose: Unsafe code that uses pointers should use
7- ** SafePointer to fix subtle lifetime problems with the
7+ ** SafeBuffer to fix subtle lifetime problems with the
88** underlying resource.
99**
1010===========================================================*/
@@ -203,6 +203,13 @@ public T Read<T>(ulong byteOffset) where T : struct
203203 return value ;
204204 }
205205
206+ /// <summary>
207+ /// Reads the specified number of value types from memory starting at the offset, and writes them into an array starting at the index.</summary>
208+ /// <typeparam name="T">The value type to read.</typeparam>
209+ /// <param name="byteOffset">The location from which to start reading.</param>
210+ /// <param name="array">The output array to write to.</param>
211+ /// <param name="index">The location in the output array to begin writing to.</param>
212+ /// <param name="count">The number of value types to read from the input array and to write to the output array.</param>
206213 [ CLSCompliant ( false ) ]
207214 public void ReadArray < T > ( ulong byteOffset , T [ ] array , int index , int count )
208215 where T : struct
@@ -219,6 +226,11 @@ public void ReadArray<T>(ulong byteOffset, T[] array, int index, int count)
219226 ReadSpan ( byteOffset , new Span < T > ( array , index , count ) ) ;
220227 }
221228
229+ /// <summary>
230+ /// Reads value types from memory starting at the offset, and writes them into a span. The number of value types that will be read is determined by the length of the span.</summary>
231+ /// <typeparam name="T">The value type to read.</typeparam>
232+ /// <param name="byteOffset">The location from which to start reading.</param>
233+ /// <param name="buffer">The output span to write to.</param>
222234 [ CLSCompliant ( false ) ]
223235 public void ReadSpan < T > ( ulong byteOffset , Span < T > buffer )
224236 where T : struct
@@ -279,6 +291,14 @@ public void Write<T>(ulong byteOffset, T value) where T : struct
279291 }
280292 }
281293
294+ /// <summary>
295+ /// Writes the specified number of value types to a memory location by reading bytes starting from the specified location in the input array.
296+ /// </summary>
297+ /// <typeparam name="T">The value type to write.</typeparam>
298+ /// <param name="byteOffset">The location in memory to write to.</param>
299+ /// <param name="array">The input array.</param>
300+ /// <param name="index">The offset in the array to start reading from.</param>
301+ /// <param name="count">The number of value types to write.</param>
282302 [ CLSCompliant ( false ) ]
283303 public void WriteArray < T > ( ulong byteOffset , T [ ] array , int index , int count )
284304 where T : struct
@@ -295,6 +315,12 @@ public void WriteArray<T>(ulong byteOffset, T[] array, int index, int count)
295315 WriteSpan ( byteOffset , new ReadOnlySpan < T > ( array , index , count ) ) ;
296316 }
297317
318+ /// <summary>
319+ /// Writes the value types from a read-only span to a memory location.
320+ /// </summary>
321+ /// <typeparam name="T">The value type to write.</typeparam>
322+ /// <param name="byteOffset">The location in memory to write to.</param>
323+ /// <param name="data">The input span.</param>
298324 [ CLSCompliant ( false ) ]
299325 public void WriteSpan < T > ( ulong byteOffset , ReadOnlySpan < T > data )
300326 where T : struct
0 commit comments