private string ChangeProperty(Property propertyClone)
        {
            if (propertyClone == null)
                return String.Empty;

            ElementBuilder eb = CodeRush.Language.GetActiveElementBuilder();

            // convert auto-implemented property...
            if (propertyClone.IsAutoImplemented)
            {
                // so it's no longer an auto-implemented property....
                propertyClone.IsAutoImplemented = false;
                // remove all nodes and create new ones...
                propertyClone.RemoveAllNodes();

                // create a field variable...
                string varName = CodeRush.Strings.Get("FormatFieldName", propertyClone.Name);
                Variable var = eb.BuildVariable(propertyClone.MemberTypeReference, varName);

                // add property getter...
                Get getter = GetGetter(eb, varName);
                propertyClone.AddNode(getter);

                // create property setter...
                Set setter = GetSetter(eb, propertyClone, varName);
                propertyClone.AddNode(setter);

                return CodeRush.Language.GenerateElement(var) + CodeRush.Language.GenerateElement(propertyClone);
            }
            else
            {
                Set setter = propertyClone.Setter;
                if (setter == null)
                    return String.Empty;

                Assignment assignment = setter.Nodes[0] as Assignment;
                if (assignment == null)
                    return String.Empty;

                string varName = assignment.LeftSide.Name;
                propertyClone.RemoveNode(setter);

                // recreate setter...
                Set newSetter = GetSetter(eb, propertyClone, varName);
                propertyClone.AddNode(newSetter);
            }
            return CodeRush.Language.GenerateElement(propertyClone);
        }
        private string ChangeProperty(Property propertyClone, bool baseClassVersion, LanguageElement classExpression)
        {
            if (propertyClone == null)
                return String.Empty;

            ElementBuilder eb = CodeRush.Language.GetActiveElementBuilder();

            // so it's no longer an auto-implemented property....
            propertyClone.IsAutoImplemented = false;
            // remove all nodes and create new ones...
            propertyClone.RemoveAllNodes();

            // create a field variable if it doesn't already exist...
            string varName = CodeRush.Strings.Get("FormatFieldName", propertyClone.Name);
            Variable var = eb.BuildVariable(propertyClone.MemberTypeReference, varName);

            // add property getter...
            //Get getter = GetGetter(eb, varName);
            //propertyClone.AddNode(getter);
            string propDecl = String.Format("public {0} {1}\n{{\n", propertyClone.MemberTypeReference, propertyClone.Name);
            string getter = String.Format("get {{ return {0}; }}\n", varName);

            // create property setter...

            Set setter;
            if (!baseClassVersion)
                setter = GetSetter(eb, propertyClone, varName);
            else
                setter = GetOnPropertyChangedLambdaSetter(eb, propertyClone, varName);
            //propertyClone.AddNode(setter);
            string setterStr = CodeRush.Language.GenerateElement(setter);
            string propBlock = String.Format("{0}{1}{2}}}", propDecl, getter, setterStr);

            // See if member is needed
            bool createField = true;
            foreach (LanguageElement member in classExpression)
            {
                if (member is IFieldElement && member.Name == varName) { createField = false; break; }
            }
            if (createField)
                return CodeRush.Language.GenerateElement(var) + propBlock;//CodeRush.Language.GenerateElement(propertyClone);
            else
                return propBlock;// CodeRush.Language.GenerateElement(propertyClone);
        }