C# Error CS0144 – Cannot create an instance of the abstract class or interface ‘interface’

C# Compiler Error

CS0144 – Cannot create an instance of the abstract class or interface ‘interface’

Reason for the Error

You will receive this error when you try to create an instance of the abstract class or an interface in C#.

For example, try compiling the below code snippet.

namespace DeveloperPublishNamespace
{
    interface IDeveloperPublish
    {

    }
    public class DeveloperPublish
    {
        public static void Main()
        {
            IDeveloperPublish obj = new IDeveloperPublish(); 
        }
    }

}

This will result in the C# error code CS0144 as the instance of the interface could not be created.

C# Error CS0144 – Cannot create an instance of the abstract class or interface 'interface'

Error CS0144 Cannot create an instance of the abstract type or interface ‘IDeveloperPublish’ ConsoleApp1 C:\Users\Senthil\source\repos\ConsoleApp1\ConsoleApp1\Program.cs 11 Active

Solution

Since C# doesn’t allow you to create an instance of abstract class or interface, you will need to change the logic to create an instance of an concrete class instead.