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

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