HomeCSharpC# Error CS0100 – The parameter name ‘parameter name’ is a duplicate

C# Error CS0100 – The parameter name ‘parameter name’ is a duplicate

C# Compiler Error

CS0100 – The parameter name ‘parameter name’ is a duplicate

Reason for the Error

You will receive this error when you have the same parameter name defined more than once during your method declaration. The parameter names must be unique as per the C# specification.

Try running the below code snippet.

namespace DeveloperPublish
{
    class Class1
    {
  
        public void SetData(int param1,int param1)
        {

        }

    }
    public class Program
    {
        public static void Main()
        {

        }
    }
}

You will receive the below error because the function SetData contains two parameters but with the same name.

Error CS0100 The parameter name ‘param1’ is a duplicate ConsoleApp2 C:\Users\admin\source\repos\ConsoleApp2\ConsoleApp2\Program.cs 6 Active

C# Error CS0100 – The parameter name 'parameter name' is a duplicate

Solution

To fix the error, rename the duplicate parameter name.

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