Expand To Show Full Article
C# 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.