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

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