示例#1
0
            private string GetText(IMethodDeclaration methodDeclaration, MethodSignature signature)
            {
                var language        = methodDeclaration.Language;
                var declaredElement = methodDeclaration.DeclaredElement;

                Assertion.AssertNotNull(declaredElement, "declaredElement != null");
                var methodName = DeclaredElementPresenter.Format(language, DeclaredElementPresenter.NAME_PRESENTER,
                                                                 declaredElement);

                switch (myMatch)
                {
                case MethodSignatureMatch.IncorrectStaticModifier:
                {
                    var staticTerm = PresentationHelper.GetHelper(language).GetStaticTerm();
                    return(signature.IsStatic == true ? $"Make '{methodName}' {staticTerm}" : $"Remove '{staticTerm}' modifier");
                }

                case MethodSignatureMatch.IncorrectParameters:
                    return($"Change parameters to '({signature.Parameters.GetParameterList()})'");

                case MethodSignatureMatch.IncorrectReturnType:
                    return($"Change return type to '{signature.GetReturnTypeName()}'");

                case MethodSignatureMatch.IncorrectTypeParameters:
                    return("Remove type parameters");

                // NoMatch, and any combination of flags
                default:
                    return($"Change signature to '{signature.FormatSignature(methodName.Text)}'");
                }
            }