How to create instance of MsftDiscMaster2 in C#
I was tinkering with the CD-burning API in the Windows Vista SDK, and one of the basic classes needed for that is MsftDiscMaster2. The MSDN example is in VBScript and does this to create an object of type MsftDiscMaster2:
Now, to port this to C-Sharp, the first thing that I tried was this:
It showed me a runtime excption: Cannot create an instance of an interface.
However, when I try this round-about way, it works!
So, how do I create an object that inherits from MsftDiscMaster2 in C#? What magic is Visual Basic doing that allows it to create an object out of an interface?
Solution: Just create an instance of the MsftDiscMaster2Class class. That's it... it is a concrete implementation of the MsftDiscMaster2 interface. Simple, isn't it?