C# Error CS0111 – Type ‘class’ already defines a member called ‘member’ with the same parameter types

C# Compiler Error

Type ‘class’ already defines a member called ‘member’ with the same parameter types

Reason for the Error

You will receive this error when you declare more than one method/function with the same name and parameter types.

For example, the below code snippet demonstrates the C# compiler error CS0111.

public class DeveloperPublish
{
    void Function1() { }
    void Function1() { }
    public static void Main()
    {

    }
}

Error CS0111 Type ‘DeveloperPublish’ already defines a member called ‘Function1’ with the same parameter types ConsoleApp1 C:\Users\Senthil\source\repos\ConsoleApp1\ConsoleApp1\Program.cs 4 Active

C# Error CS0111 – Type 'class' already defines a member called 'member' with the same parameter types
C# Error CS0111 – Type ‘class’ already defines a member called ‘member’ with the same parameter types

Solution

To fix the above error, rename the function or apply the concept of function overloading.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Hey, wait!Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.