class Program
        static int localVariable = 0;

        static int PropertyOne
            get { return localVariable; }

        static void set_PropertyOne(int newValue)
            localVariable = newValue;

        static void Main(string[] args)

**Error: already defines a member called 'set_PropertyOne' with the same parameter type**

please give me reason why is this happening. i dont need solution i need a reason for this error

6 Years
Discussion Span
Last Post by gemini88

Well, I am not really sure about the reason, but I see it this way:
I suspect that the declaration of a dynamic property defines a set method that has the name set_propertyName. And as you are trying to create a method that has the exaclty same name it gives the error. AS I said it is how I see it, and I AM MOST PROBABLY wrong because Im not really well aware of how things work. I am a total newbie.
That is only the explanation i can think of, I dont want to mislead you. I am actually interested in finding the answer too. :)


I got the answer "the compiler breaks the code by itself in to two chunks; set_methodname and get_methodname in this case "set_PropertyOne"." so compiler gives error for already defined member....

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.