ide*_*ide 9 c# com interop coclass
我没有很多关于COM和coclasses的背景知识,所以我不太明白为什么我可以使用new带接口的运算符.从语言/框架无关的角度来看,令人困惑的是,为什么编译和运行正确:
using Microsoft.Office.Interop.Excel;
public class ExcelProgram
{
static void Main(string[] args)
{
Application excel = new Application();
}
}
Run Code Online (Sandbox Code Playgroud)
Application在Visual Studio 2010中进行检查向我显示:
using System.Runtime.InteropServices;
namespace Microsoft.Office.Interop.Excel
{
// Summary:
// Represents the entire Microsoft Excel application.
[Guid("000208D5-0000-0000-C000-000000000046")]
[CoClass(typeof(ApplicationClass))]
public interface Application : _Application, AppEvents_Event
{
}
}
Run Code Online (Sandbox Code Playgroud)
幕后发生了什么?