interopservices

Shorten amount of DllImport in C#?

允我心安 提交于 2020-02-07 08:26:15
问题 Here is a sample of my C# code. Is there a way to decrease the amount of DllImport attributes? namespace CSLib { class Program { static void Main(string[] args) { CLib.test(); CLib.test2(3); A a = new A() { a = 9, b = 5 }; CLib.test3(ref a); } } class CLib { [DllImport("path/to/CDLL", CallingConvention = CallingConvention.Cdecl)] public static extern void test(); [DllImport("path/to/CDLL", CallingConvention = CallingConvention.Cdecl)] public static extern void test2(int a); [DllImport("path

What is IExpando and where is it used?

冷暖自知 提交于 2019-12-23 12:43:55
问题 I was browsing the types in mscorlib using reflector (like you do...) and came across the IExpando interface, in the System.Runtime.InteropServices.Expando namespace. I did a search in reflector and even checked out MSDN, it seems that no types in mscorlib implement this interface. There are also no code examples on MSDN. Has anyone implemented this interface in their own code? Does anyone know what it is used for exactly? Thanks 回答1: Yeah, it is a bit out-of-place today. It is the managed

System.Runtime.InteropServices.COMException (0x800A1436)

浪尽此生 提交于 2019-12-08 09:36:57
问题 We are trying to open a Word template which resides on a Shared Drive using Office Interop Services on an MVC application.The solution is working locally, but once is deployed to the server the following message appears: The File was not created: System.Runtime.InteropServices.COMException (0x800A1436): This file could not be found ApplicationPool is running under a domain user account which already has permissions on the shared drive. Any suggestion? 回答1: You may consider using the Open XML

Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation

六月ゝ 毕业季﹏ 提交于 2019-11-30 07:54:53
问题 I am getting this error whenever I try and run a webjob project with application insight and entity framework. System.IO.FileLoadException: 'Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)' I have installed the following nuget packages Microsoft