コード例 #1
0
        private IEnumerable <Diagnostic> AnalyzeInitializerExpression(InitializerExpressionSyntax node, SemanticModel semanticModel)
        {
            var symbol = node.GetEnclosingSymbol(semanticModel);

            var diagnostics = node.Expressions.OfType <AssignmentExpressionSyntax>()
                              .Where(_ => _.IsKind(SyntaxKind.SimpleAssignmentExpression))
                              .SelectMany(_ => AnalyzeExpression(_.Right, symbol.Name, _.GetLocation()));

            return(diagnostics);
        }