mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
24 lines
514 B
C#
24 lines
514 B
C#
namespace System.Runtime.InteropServices
|
|
{
|
|
internal static class MarshalEx
|
|
{
|
|
public static int SizeOf<T>()
|
|
{
|
|
#if NETSTANDARD1_0_OR_GREATER
|
|
return Marshal.SizeOf<T>();
|
|
#else
|
|
return Marshal.SizeOf(typeof(T));
|
|
#endif
|
|
}
|
|
|
|
public static T PtrToStructure<T>(IntPtr ptr)
|
|
{
|
|
#if NETSTANDARD1_0_OR_GREATER
|
|
return Marshal.PtrToStructure<T>(ptr);
|
|
#else
|
|
return (T)Marshal.PtrToStructure(ptr, typeof(T));
|
|
#endif
|
|
}
|
|
}
|
|
}
|