C# Error CS0528 – ‘interface’ is already listed in interface list

C# Compiler Error

CS0528 – ‘interface’ is already listed in interface list

Reason for the Error

You’ll get this error in your C# code when you have duplicate interfaces in the inheritance list.

For example, let’s try to compile the below C# code snippet.

using System;
namespace DeveloperPublishNamespace
{
    public interface IDeveloperPublish
    {
    }

    public class DeveloperPublish : IDeveloperPublish, IDeveloperPublish
    {

    }

    class Program
    {
      
        static void Main(string[] args)
        {
            Console.WriteLine("No Error");
        }
    }
}

You’ll receive the error code CS0528 when run the above code snippet because you have included the interface IDeveloperPublish multiple times in the inheritance list for the class DeveloperPublish.

Error CS0528 ‘IDeveloperPublish’ is already listed in interface list DeveloperPublish C:\Users\SenthilBalu\source\repos\ConsoleApp4\ConsoleApp4\Program.cs 8 Active

C# Error CS0528 - 'interface' is already listed in interface list

Solution

To fix this error in your C# code, you will need to remove the duplicate interface from the inheritance list of your program.

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...