Tuesday, October 07, 2008 #

Prop Snippet Fail

This is one that belongs on failblog. I happen to be using Visual Studio 2005 at work, so the prop snippet generates a private member variable to encapsulate in a property. In this case, I needed the property "Value". Guess what happens?

        private string value;

        
public string Value
        {
            
get { return value; }
            
set { value = value; }
        }

Fail. The only thing that needs to be done to correct this is to qualify value in the setter. 

            set { this.value = value; }

There's no reason to make a better prop snippet now that it generates automatic properties in Visual Studio 2008. This problem merely amused me.

posted @ Tuesday, October 07, 2008 2:45 PM | Feedback (0)