internal static unsafe void GenericPtrToStructure <T>(byte *ptr, out T structure, uint sizeofT) where T : struct { structure = default(T); SafeBuffer.PtrToStructureNative(ptr, __makeref(structure), sizeofT); }