Creating instance of interface in C#

后端 未结 3 1460
暖寄归人
暖寄归人 2021-01-05 21:28

I\'m working with MS Excel interop in C# and I don\'t understand how this particular line of code works:

var excel = new Microsoft.Office.Interop.Excel.Appli         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-05 21:58

    Actually code that you mentioned created instance of the ApplicationClass class and that is what CoClass attribute does.

    See this answer for details: How does the C# compiler detect COM types?

提交回复
热议问题