Added workaround for missing function in .NET Std 2.0

pull/83/head
David Hall 2019-10-23 12:20:52 -06:00
parent 457a71d750
commit a8e15280e1
1 changed files with 9 additions and 0 deletions

View File

@ -45,7 +45,11 @@ namespace Vanara.InteropServices
var result = IntPtr.Zero;
try
{
#if NETSTANDARD2_0
result = Marshal.GetComInterfaceForObject(target, typeof(IDispatch));
#else
result = Marshal.GetIDispatchForObject(target);
#endif
}
finally
{
@ -55,5 +59,10 @@ namespace Vanara.InteropServices
}
return result;
}
#if NETSTANDARD2_0
[ComImport, Guid("00020400-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
private interface IDispatch { }
#endif
}
}