Exposed fields for SafeDRT_DATA and added implicit operator to DRT_DATA.

pull/180/head
dahall 2020-09-10 10:14:34 -06:00
parent a8ef6e11c8
commit a2bdc5cdf1
1 changed files with 7 additions and 2 deletions

View File

@ -2345,10 +2345,10 @@ namespace Vanara.PInvoke
public class SafeDRT_DATA : IDisposable
{
/// <summary>A DWORD variable that contains the count, in bytes, of data.</summary>
private uint cb;
public readonly uint cb;
/// <summary>A pointer to the data buffer.</summary>
private IntPtr pb;
public readonly IntPtr pb;
/// <summary>Initializes a new instance of the <see cref="SafeDRT_DATA"/> class.</summary>
/// <param name="size">The size, in bytes, to allocate.</param>
@ -2387,6 +2387,11 @@ namespace Vanara.PInvoke
cb = 0;
}
/// <summary>Performs an implicit conversion from <see cref="SafeDRT_DATA"/> to <see cref="DRT_DATA"/>.</summary>
/// <param name="safeData">The safe data.</param>
/// <returns>The resulting <see cref="DRT_DATA"/> instance from the conversion.</returns>
public static implicit operator DRT_DATA(SafeDRT_DATA safeData) => new DRT_DATA { cb = safeData.cb, pb = safeData.pb };
/// <summary>Allocates from unmanaged memory sufficient memory to hold an object of type T.</summary>
/// <typeparam name="T">Native type</typeparam>
/// <param name="value">The value.</param>