C# Error CS1722 – Base class ‘{0}’ must come before any interfaces

C# Error

CS1722 – Base class ‘{0}’ must come before any interfaces

Reason for the Error & Solution

Base class ‘class’ must come before any interfaces

When specifying a class to inherit from and interfaces to implement, the class name must be specified first.

Example

The following sample generates CS1722.

// CS1722.cs  
// compile with: /target:library  
public class A {}  
interface I {}  
  
public class MyClass : I, A {}   // CS1722  
public class MyClass2 : A, I {}   // OK  

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...