Made SafeMemoryHandle conversion to IntPtr implicit instead of explicit. In practice, I have found this to be a constant conversion need.

pull/83/head
David Hall 2019-07-25 10:48:43 -06:00
parent 2bf048944a
commit 0fef11ebb1
1 changed files with 3 additions and 3 deletions

View File

@ -174,12 +174,12 @@ namespace Vanara.InteropServices
/// <summary>Performs an explicit conversion from <see cref="SafeAllocatedMemoryHandle"/> to <see cref="byte"/> pointer.</summary>
/// <param name="hMem">The <see cref="SafeAllocatedMemoryHandle"/> instance.</param>
/// <returns>The result of the conversion.</returns>
public static unsafe explicit operator byte* (SafeAllocatedMemoryHandle hMem) => (byte*)hMem.handle;
public static unsafe explicit operator byte*(SafeAllocatedMemoryHandle hMem) => (byte*)hMem.handle;
/// <summary>Performs an explicit conversion from <see cref="SafeAllocatedMemoryHandle"/> to <see cref="System.IntPtr"/>.</summary>
/// <summary>Performs an implicit conversion from <see cref="SafeAllocatedMemoryHandle"/> to <see cref="System.IntPtr"/>.</summary>
/// <param name="hMem">The <see cref="SafeAllocatedMemoryHandle"/> instance.</param>
/// <returns>The result of the conversion.</returns>
public static explicit operator IntPtr(SafeAllocatedMemoryHandle hMem) => hMem.handle;
public static implicit operator IntPtr(SafeAllocatedMemoryHandle hMem) => hMem.handle;
private class SafeBufferImpl : SafeBuffer
{