With Office interop in C#, I can write the following:
protected override Excel.Application Create()
{
return new Excel.Application();
}
This works just fine and calls like this frequently appear in articles about Office interop, but Excel.Application
is actually an interface.
Using object explorer in Visual studio, it appears that the return value of the method is a Microsoft.Office.Interop.Excel.Application
, but the method being called is actually Microsoft.Office.Interop.Excel.ApplicationClass.ApplicationClass()
.
So how is new Application()
actually getting resolved as ApplicationClass.ApplicationClass()
?