Having said that, the following program is invalid: -
class Foo { } class Bar { } class MITest : Foo, Bar { public static void Main () { } }
The error that you'll get in this example has to do with how you implement interfaces. The interfaces you choose to implement are listed after the class's base class. Therefore, in this example, the C# compiler thinks that Bar should be an interface type. That's why the C# compiler will give you the following error message: -
'Bar' : type in interface list is not an interface
The following, more realistic, example is perfectly valid because the MyFancyGrid class is derived from Control and implements the ISerializable and IDataBound interfaces: -
class Control { } interface ISerializable { } interface IDataBound { } class MyFancyGrid : Control, ISerializable, IDataBound { }
The point here is that the only way you can implement something like multiple inheritance in C# is through the use of interfaces.