From 9f15f5b89e6bb19f057d0681cc2274952860288a Mon Sep 17 00:00:00 2001 From: gaschd Date: Wed, 6 Nov 2024 23:04:49 +0100 Subject: [PATCH] WithDeclarationNameCasing tries to match nodes case sensitive first, then case insensitive --- CodeConverter/CSharp/CommonConversions.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CodeConverter/CSharp/CommonConversions.cs b/CodeConverter/CSharp/CommonConversions.cs index 3b540339..8636907f 100644 --- a/CodeConverter/CSharp/CommonConversions.cs +++ b/CodeConverter/CSharp/CommonConversions.cs @@ -229,7 +229,9 @@ private static TypeSyntax WithDeclarationNameCasing(TypeSyntax syntax, ITypeSymb return syntax.ReplaceNodes(syntax.DescendantNodes().OfType(), (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; }); }