public override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
{
var updatedClassDeclaration = (ClassDeclarationSyntax)base.VisitClassDeclaration(node);
// Get TypeSymbol corresponding to the ClassDeclarationSyntax and check whether
// it is the same as the TypeSymbol we are searching for.
TypeSymbol classSymbol = SemanticModel.GetDeclaredSymbol(node);
if (classSymbol.Equals(SearchSymbol))
{
// Replace the identifier token containing the name of the class.
SyntaxToken updatedIdentifierToken =
Syntax.Identifier(
updatedClassDeclaration.Identifier.LeadingTrivia,
NewName,
updatedClassDeclaration.Identifier.TrailingTrivia);
updatedClassDeclaration = updatedClassDeclaration.WithIdentifier(updatedIdentifierToken);
}
return updatedClassDeclaration;
}