Exemplo n.º 1
0
        public static void ReplaceNullWithDefaultValue(
            CodeFixContext context,
            Diagnostic diagnostic,
            ExpressionSyntax expression,
            ITypeSymbol typeSymbol,
            string additionalKey = null)
        {
            if (!typeSymbol.SupportsExplicitDeclaration())
            {
                return;
            }

            CodeAction codeAction = CodeActionFactory.ReplaceNullWithDefaultValue(context.Document, expression, typeSymbol, equivalenceKey: EquivalenceKey.Create(diagnostic, additionalKey));

            context.RegisterCodeFix(codeAction, diagnostic);
        }