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.

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