문제

I don't have very much background regarding COM nor coclasses, so I don't quite understand why I can use the new operator with an interface. From a language/framework-agnostic view, it's confusing why this compiles and runs correctly:

using Microsoft.Office.Interop.Excel;

public class ExcelProgram
{
    static void Main(string[] args)
    {
        Application excel = new Application();
    }
}

Inspecting Application in Visual Studio 2010 shows me:

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
    {
    }
}

What is going on behind the scenes?

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top