C# Error CS0082 – Type ‘type’ already reserves a member called ‘name’ with the same parameter types

C# Compiler Error

CS0082 – Type ‘type’ already reserves a member called ‘name’ with the same parameter types

Reason for the Error

When you define properties for your class, they are translated to the methods with get_ and set_ in front of the identifier. When you define your own method with the conflicting method name, you will receive this error.

Run the below code snippet.

namespace DeveloperPublish
{
    class Class1
    {
  
        public int Prop1
        {
            get  
            {
                return 1;
            }
        }
 
        public int get_Prop1()
        {
            return 2;
        }

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

        }
    }
}

You will receive the below error because the property Prop1 and get_Prop1 conflicts at the compile time.

Error CS0082 Type ‘Class1’ already reserves a member called ‘get_Prop1’ with the same parameter types ConsoleApp2 C:\Users\admin\source\repos\ConsoleApp2\ConsoleApp2\Program.cs 8 Active

C# Error CS0082 – Type 'type' already reserves a member called 'name' with the same parameter types

Solution

To fix the error, ensure that the property names dont conflict and rename the property if possible.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Hey, wait!Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.