Ejemplo n.º 1
0
        private static bool ParentIsAssignmentWithCreation(ref string typeName, LanguageElement element)
        {
            Assignment parentAssignment = element.Parent as Assignment;

            if (parentAssignment == null || parentAssignment.LeftSide != element)
            {
                return(false);
            }

            if (!(parentAssignment.Expression is ObjectCreationExpression))
            {
                return(false);
            }

            if (parentAssignment.Parent is UsingStatement)
            {
                return(false);
            }

            LanguageElement localDeclaration = CodeRush.Refactoring.FindLocalDeclaration(element);

            if (localDeclaration == null)
            {
                return(false);
            }


            typeName = localDeclaration.GetTypeName();
            return(true);
        }