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.

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