<PackageReference Include="NETStandard.Library" Version="2.0.2" />

System.Runtime.InteropServices.Marshal

public static class Marshal
namespace System.Runtime.InteropServices { public static class Marshal { public static readonly int SystemDefaultCharSize; public static readonly int SystemMaxDBCSCharSize; public static int AddRef(IntPtr pUnk); public static IntPtr AllocCoTaskMem(int cb); public static IntPtr AllocHGlobal(int cb); public static IntPtr AllocHGlobal(IntPtr cb); public static bool AreComObjectsAvailableForCleanup(); public static object BindToMoniker(string monikerName); public static void ChangeWrapperHandleStrength(object otp, bool fIsWeak); public static void CleanupUnusedObjectsInCurrentContext(); public static void Copy(byte[] source, int startIndex, IntPtr destination, int length); public static void Copy(char[] source, int startIndex, IntPtr destination, int length); public static void Copy(double[] source, int startIndex, IntPtr destination, int length); public static void Copy(short[] source, int startIndex, IntPtr destination, int length); public static void Copy(int[] source, int startIndex, IntPtr destination, int length); public static void Copy(long[] source, int startIndex, IntPtr destination, int length); public static void Copy(IntPtr source, byte[] destination, int startIndex, int length); public static void Copy(IntPtr source, char[] destination, int startIndex, int length); public static void Copy(IntPtr source, double[] destination, int startIndex, int length); public static void Copy(IntPtr source, short[] destination, int startIndex, int length); public static void Copy(IntPtr source, int[] destination, int startIndex, int length); public static void Copy(IntPtr source, long[] destination, int startIndex, int length); public static void Copy(IntPtr source, IntPtr[] destination, int startIndex, int length); public static void Copy(IntPtr source, float[] destination, int startIndex, int length); public static void Copy(IntPtr[] source, int startIndex, IntPtr destination, int length); public static void Copy(float[] source, int startIndex, IntPtr destination, int length); public static IntPtr CreateAggregatedObject(IntPtr pOuter, object o); public static IntPtr CreateAggregatedObject<T>(IntPtr pOuter, T o); public static object CreateWrapperOfType(object o, Type t); public static TWrapper CreateWrapperOfType<T, TWrapper>(T o); public static void DestroyStructure(IntPtr ptr, Type structuretype); public static void DestroyStructure<T>(IntPtr ptr); public static int FinalReleaseComObject(object o); public static void FreeBSTR(IntPtr ptr); public static void FreeCoTaskMem(IntPtr ptr); public static void FreeHGlobal(IntPtr hglobal); public static IntPtr GetComInterfaceForObject(object o, Type T); public static IntPtr GetComInterfaceForObject(object o, Type T, CustomQueryInterfaceMode mode); public static IntPtr GetComInterfaceForObject<T, TInterface>(T o); public static Delegate GetDelegateForFunctionPointer(IntPtr ptr, Type t); public static TDelegate GetDelegateForFunctionPointer<TDelegate>(IntPtr ptr); public static int GetExceptionCode(); public static Exception GetExceptionForHR(int errorCode); public static Exception GetExceptionForHR(int errorCode, IntPtr errorInfo); public static IntPtr GetFunctionPointerForDelegate(Delegate d); public static IntPtr GetFunctionPointerForDelegate<TDelegate>(TDelegate d); public static int GetHRForException(Exception e); public static int GetHRForLastWin32Error(); public static IntPtr GetIUnknownForObject(object o); public static int GetLastWin32Error(); public static void GetNativeVariantForObject(object obj, IntPtr pDstNativeVariant); public static void GetNativeVariantForObject<T>(T obj, IntPtr pDstNativeVariant); public static object GetObjectForIUnknown(IntPtr pUnk); public static object GetObjectForNativeVariant(IntPtr pSrcNativeVariant); public static T GetObjectForNativeVariant<T>(IntPtr pSrcNativeVariant); public static object[] GetObjectsForNativeVariants(IntPtr aSrcNativeVariant, int cVars); public static T[] GetObjectsForNativeVariants<T>(IntPtr aSrcNativeVariant, int cVars); public static int GetStartComSlot(Type t); public static Type GetTypeFromCLSID(Guid clsid); public static string GetTypeInfoName(ITypeInfo typeInfo); public static object GetUniqueObjectForIUnknown(IntPtr unknown); public static bool IsComObject(object o); public static IntPtr OffsetOf(Type t, string fieldName); public static IntPtr OffsetOf<T>(string fieldName); public static void Prelink(MethodInfo m); public static void PrelinkAll(Type c); public static string PtrToStringAnsi(IntPtr ptr); public static string PtrToStringAnsi(IntPtr ptr, int len); public static string PtrToStringAuto(IntPtr ptr); public static string PtrToStringAuto(IntPtr ptr, int len); public static string PtrToStringBSTR(IntPtr ptr); public static string PtrToStringUni(IntPtr ptr); public static string PtrToStringUni(IntPtr ptr, int len); public static void PtrToStructure(IntPtr ptr, object structure); public static object PtrToStructure(IntPtr ptr, Type structureType); public static T PtrToStructure<T>(IntPtr ptr); public static void PtrToStructure<T>(IntPtr ptr, T structure); public static int QueryInterface(IntPtr pUnk, ref Guid iid, out IntPtr ppv); public static byte ReadByte(IntPtr ptr); public static byte ReadByte(IntPtr ptr, int ofs); public static byte ReadByte(object ptr, int ofs); public static short ReadInt16(IntPtr ptr); public static short ReadInt16(IntPtr ptr, int ofs); public static short ReadInt16(object ptr, int ofs); public static int ReadInt32(IntPtr ptr); public static int ReadInt32(IntPtr ptr, int ofs); public static int ReadInt32(object ptr, int ofs); public static long ReadInt64(IntPtr ptr); public static long ReadInt64(IntPtr ptr, int ofs); public static long ReadInt64(object ptr, int ofs); public static IntPtr ReadIntPtr(IntPtr ptr); public static IntPtr ReadIntPtr(IntPtr ptr, int ofs); public static IntPtr ReadIntPtr(object ptr, int ofs); public static IntPtr ReAllocCoTaskMem(IntPtr pv, int cb); public static IntPtr ReAllocHGlobal(IntPtr pv, IntPtr cb); public static int Release(IntPtr pUnk); public static int ReleaseComObject(object o); public static IntPtr SecureStringToBSTR(SecureString s); public static IntPtr SecureStringToCoTaskMemAnsi(SecureString s); public static IntPtr SecureStringToCoTaskMemUnicode(SecureString s); public static IntPtr SecureStringToGlobalAllocAnsi(SecureString s); public static IntPtr SecureStringToGlobalAllocUnicode(SecureString s); public static int SizeOf(object structure); public static int SizeOf(Type t); public static int SizeOf<T>(); public static int SizeOf<T>(T structure); public static IntPtr StringToBSTR(string s); public static IntPtr StringToCoTaskMemAnsi(string s); public static IntPtr StringToCoTaskMemAuto(string s); public static IntPtr StringToCoTaskMemUni(string s); public static IntPtr StringToHGlobalAnsi(string s); public static IntPtr StringToHGlobalAuto(string s); public static IntPtr StringToHGlobalUni(string s); public static void StructureToPtr(object structure, IntPtr ptr, bool fDeleteOld); public static void StructureToPtr<T>(T structure, IntPtr ptr, bool fDeleteOld); public static void ThrowExceptionForHR(int errorCode); public static void ThrowExceptionForHR(int errorCode, IntPtr errorInfo); public static IntPtr UnsafeAddrOfPinnedArrayElement(Array arr, int index); public static IntPtr UnsafeAddrOfPinnedArrayElement<T>(T[] arr, int index); public static void WriteByte(IntPtr ptr, byte val); public static void WriteByte(IntPtr ptr, int ofs, byte val); public static void WriteByte(object ptr, int ofs, byte val); public static void WriteInt16(IntPtr ptr, char val); public static void WriteInt16(IntPtr ptr, short val); public static void WriteInt16(IntPtr ptr, int ofs, char val); public static void WriteInt16(IntPtr ptr, int ofs, short val); public static void WriteInt16(object ptr, int ofs, char val); public static void WriteInt16(object ptr, int ofs, short val); public static void WriteInt32(IntPtr ptr, int val); public static void WriteInt32(IntPtr ptr, int ofs, int val); public static void WriteInt32(object ptr, int ofs, int val); public static void WriteInt64(IntPtr ptr, int ofs, long val); public static void WriteInt64(IntPtr ptr, long val); public static void WriteInt64(object ptr, int ofs, long val); public static void WriteIntPtr(IntPtr ptr, int ofs, IntPtr val); public static void WriteIntPtr(IntPtr ptr, IntPtr val); public static void WriteIntPtr(object ptr, int ofs, IntPtr val); public static void ZeroFreeBSTR(IntPtr s); public static void ZeroFreeCoTaskMemAnsi(IntPtr s); public static void ZeroFreeCoTaskMemUnicode(IntPtr s); public static void ZeroFreeGlobalAllocAnsi(IntPtr s); public static void ZeroFreeGlobalAllocUnicode(IntPtr s); } }