HomeCSharpC# Error CS0527 – Type ‘type’ in interface list is not an interface

C# Error CS0527 – Type ‘type’ in interface list is not an interface

C# Compiler Error

CS0527 – Type ‘type’ in interface list is not an interface

Reason for the Error

You’ll get this error in your C# code when you try to inherit a struct or interface from any other type apart from an interface.

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

using System;
namespace DeveloperPublishNamespace
{
    public interface IDeveloperPublish : int
    {
    }

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

You’ll receive the error code CS0527 in the above code snippet because you are trying to inherit the interface IDeveloperPublish from an int type instead of another interface.

Error CS0527 Type ‘int’ in interface list is not an interface DeveloperPublish C:\Users\SenthilBalu\source\repos\ConsoleApp4\ConsoleApp4\Program.cs 4 Active

C# Error CS0527 - Type 'type' in interface list is not an interface

Solution

In C#, the struct and interfaces can inherit from an interface only.

To fix this error in your C# code, you will need to non-interface inheritance from the struct or interface definition.

Leave A Reply

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

You May Also Like

This C# program calculates and displays an upper triangular matrix based on user input. Problem Statement: The program takes the...
This C# program serves as a demonstration of bitwise operators, which are fundamental operators used for manipulating individual bits in...
This C# program is designed to interchange or swap the columns of a matrix. A matrix is a two-dimensional array...