using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace PDFPatcher.Common
{
static class PInvokeHelper
{
///
/// 将 指针对应的数据转换为 类型实例。
///
/// 传出类型实例。
/// 指向数据的指针。
/// 指针封装后的托管实例。
internal static T Unwrap(this IntPtr ptr) where T : class, new() {
var t = new T();
Marshal.PtrToStructure(ptr, t);
return t;
}
}
}