mirror of https://github.com/dahall/Vanara.git
Changed Write method to take structure as 'in' param.
parent
1b472f58be
commit
05bd6d2098
|
@ -659,7 +659,7 @@ namespace Vanara.Extensions
|
|||
/// <param name="allocatedBytes">If known, the total number of bytes allocated to the native memory in <paramref name="ptr"/>.</param>
|
||||
/// <returns>The number of bytes written. The offset is not included.</returns>
|
||||
/// <exception cref="InsufficientMemoryException"></exception>
|
||||
public static int Write<T>(this IntPtr ptr, T value, int offset = 0, SizeT allocatedBytes = default) where T : struct =>
|
||||
public static int Write<T>(this IntPtr ptr, in T value, int offset = 0, SizeT allocatedBytes = default) where T : struct =>
|
||||
WriteNoChecks(ptr, value, offset, allocatedBytes);
|
||||
|
||||
internal static Type TrueType(Type type, out int size)
|
||||
|
|
|
@ -426,7 +426,7 @@ namespace Vanara.InteropServices
|
|||
/// <param name="value">The value to write.</param>
|
||||
/// <param name="autoExtend">if set to <c>true</c> automatically extend the allocated memory to the size required to hold <paramref name="value"/>.</param>
|
||||
/// <param name="offset">The number of bytes to offset from the beginning of this allocated memory before writing.</param>
|
||||
public void Write<T>(T value, bool autoExtend = true, int offset = 0) where T : struct
|
||||
public void Write<T>(in T value, bool autoExtend = true, int offset = 0) where T : struct
|
||||
{
|
||||
if (IsInvalid) throw new MemberAccessException("Safe memory pointer is not valid.");
|
||||
if (autoExtend)
|
||||
|
|
Loading…
Reference in New Issue