Domanda

Non ho molto background riguardo al com né al coclass new operatore con un'interfaccia. Da una visione lingua/framework-agnostica, è confuso il motivo per cui questo compila correttamente:

using Microsoft.Office.Interop.Excel;

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

Ispezione Application In Visual Studio 2010 mi mostra:

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

Cosa sta succedendo dietro le quinte?

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top