public override void VisitVariableDeclaration(VariableDeclarationSyntax node) { var symbol = _semanticModel.GetSymbolInfo(node.Type).Symbol; if (symbol == null) { return; } var type = symbol.ToDisplayString(); ClassReferences.Add(type); base.VisitVariableDeclaration(node); }
public override void VisitAssignmentExpression(AssignmentExpressionSyntax node) { var objectCreationExpressionSyntaxs = node.DescendantNodes().OfType <ObjectCreationExpressionSyntax>(); foreach (var expressionSyntax in objectCreationExpressionSyntaxs) { var symbol = _semanticModel.GetSymbolInfo(expressionSyntax).Symbol; if (symbol == null) { continue; } var type = symbol.ContainingSymbol.ToDisplayString(); ClassReferences.Add(type); } base.VisitAssignmentExpression(node); }