Skip to content

Commit

Permalink
WithDeclarationNameCasing tries to match nodes case sensitive first, …
Browse files Browse the repository at this point in the history
…then case insensitive
  • Loading branch information
gaschd committed Nov 6, 2024
1 parent 4d9be43 commit 9f15f5b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CodeConverter/CSharp/CommonConversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ private static TypeSyntax WithDeclarationNameCasing(TypeSyntax syntax, ITypeSymb

return syntax.ReplaceNodes(syntax.DescendantNodes().OfType<CSSyntax.IdentifierNameSyntax>(), (oldNode, _) =>
{
var originalName = originalNames.FirstOrDefault(on => string.Equals(on, oldNode.ToString(), StringComparison.OrdinalIgnoreCase));
string oldNodeStr = oldNode.ToString();
var originalName = originalNames.FirstOrDefault(on => string.Equals(on, oldNodeStr, StringComparison.Ordinal)) ??
originalNames.FirstOrDefault(on => string.Equals(on, oldNodeStr, StringComparison.OrdinalIgnoreCase));
return originalName != null ? ValidSyntaxFactory.IdentifierName(originalName) : oldNode;
});
}
Expand Down

0 comments on commit 9f15f5b

Please sign in to comment.