mirror of https://github.com/dahall/Vanara.git
Changed structure input parameter to CreateFromStructure to 'in' for memory classes
parent
d72cca74cb
commit
ae0251ded9
|
@ -82,7 +82,7 @@ namespace Vanara.InteropServices
|
|||
/// <typeparam name="T">Native type</typeparam>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns><see cref="SafeCoTaskMemHandle"/> object to an native (unmanaged) memory block the size of T.</returns>
|
||||
public static SafeCoTaskMemHandle CreateFromStructure<T>(T value = default) => new SafeCoTaskMemHandle(InteropExtensions.StructureToPtr(value, new CoTaskMemoryMethods().AllocMem, out int s), s);
|
||||
public static SafeCoTaskMemHandle CreateFromStructure<T>(in T value = default) => new SafeCoTaskMemHandle(InteropExtensions.StructureToPtr(value, new CoTaskMemoryMethods().AllocMem, out int s), s);
|
||||
|
||||
/// <summary>
|
||||
/// Allocates from unmanaged memory to represent a structure with a variable length array at the end and marshal these structure elements. It is the
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Vanara.InteropServices
|
|||
/// <typeparam name="T">Native type</typeparam>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns><see cref="SafeHGlobalHandle"/> object to an native (unmanaged) memory block the size of T.</returns>
|
||||
public static SafeHGlobalHandle CreateFromStructure<T>(T value = default) => new SafeHGlobalHandle(InteropExtensions.StructureToPtr(value, new HGlobalMemoryMethods().AllocMem, out int s), s);
|
||||
public static SafeHGlobalHandle CreateFromStructure<T>(in T value = default) => new SafeHGlobalHandle(InteropExtensions.StructureToPtr(value, new HGlobalMemoryMethods().AllocMem, out int s), s);
|
||||
|
||||
/// <summary>
|
||||
/// Allocates from unmanaged memory to represent a structure with a variable length array at the end and marshal these structure elements. It is the
|
||||
|
|
|
@ -1527,7 +1527,7 @@ namespace Vanara.PInvoke
|
|||
/// <typeparam name="T">Native type</typeparam>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns><see cref="SafeHeapBlock"/> object to an native (unmanaged) memory block the size of T.</returns>
|
||||
public static SafeHeapBlock CreateFromStructure<T>(T value = default) => new SafeHeapBlock(InteropExtensions.StructureToPtr(value, new CoTaskMemoryMethods().AllocMem, out int s), s);
|
||||
public static SafeHeapBlock CreateFromStructure<T>(in T value = default) => new SafeHeapBlock(InteropExtensions.StructureToPtr(value, new CoTaskMemoryMethods().AllocMem, out int s), s);
|
||||
|
||||
/// <summary>Converts an <see cref="IntPtr"/> to a <see cref="SafeHeapBlock"/> where it owns the reference.</summary>
|
||||
/// <param name="ptr">The <see cref="IntPtr"/>.</param>
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace Vanara.InteropServices
|
|||
/// <typeparam name="T">Native type</typeparam>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns><see cref="SafeLocalHandle"/> object to an native (unmanaged) memory block the size of T.</returns>
|
||||
public static SafeLocalHandle CreateFromStructure<T>(T value = default) => new SafeLocalHandle(InteropExtensions.StructureToPtr(value, new LocalMemoryMethods().AllocMem, out var s), s);
|
||||
public static SafeLocalHandle CreateFromStructure<T>(in T value = default) => new SafeLocalHandle(InteropExtensions.StructureToPtr(value, new LocalMemoryMethods().AllocMem, out var s), s);
|
||||
|
||||
/// <summary>Converts an <see cref="IntPtr"/> to a <see cref="SafeLocalHandle"/> where it owns the reference.</summary>
|
||||
/// <param name="ptr">The <see cref="IntPtr"/>.</param>
|
||||
|
|
Loading…
Reference in New Issue