From 2bf3e8c9f9d1ea2a7c396e3200a0a428f2a474ea Mon Sep 17 00:00:00 2001 From: Karan Chadha Date: Mon, 8 Sep 2025 23:18:05 +0530 Subject: [PATCH] refactor(csharp): replace escaped quotes in interpolated strings with raw string literals for clarity --- DataStructures/AATree/AATree.cs | 2 +- DataStructures/AVLTree/AVLTree.cs | 5 ++--- DataStructures/BinarySearchTree/BinarySearchTree.cs | 2 +- DataStructures/RedBlackTree/RedBlackTree.cs | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/DataStructures/AATree/AATree.cs b/DataStructures/AATree/AATree.cs index c2f2eeae..4b513cdc 100644 --- a/DataStructures/AATree/AATree.cs +++ b/DataStructures/AATree/AATree.cs @@ -213,7 +213,7 @@ private AaTreeNode Add(TKey key, AaTreeNode? node) } else { - throw new ArgumentException($"Key \"{key}\" already in tree!", nameof(key)); + throw new ArgumentException($"""Key "{key}" already in tree!""", nameof(key)); } return Split(Skew(node))!; diff --git a/DataStructures/AVLTree/AVLTree.cs b/DataStructures/AVLTree/AVLTree.cs index 8ac665aa..4d79b747 100644 --- a/DataStructures/AVLTree/AVLTree.cs +++ b/DataStructures/AVLTree/AVLTree.cs @@ -360,8 +360,7 @@ private AvlTreeNode Add(AvlTreeNode node, TKey key) } else { - throw new ArgumentException( - $"Key \"{key}\" already exists in AVL tree."); + throw new ArgumentException($"""Key "{key}" already exists in AVL tree."""); } // Check all of the new node's ancestors for inbalance and perform @@ -382,7 +381,7 @@ private AvlTreeNode Add(AvlTreeNode node, TKey key) if (node == null) { throw new KeyNotFoundException( - $"Key \"{key}\" is not in the AVL tree."); + $"""Key "{key}" is not in the AVL tree."""); } // Normal binary search tree removal diff --git a/DataStructures/BinarySearchTree/BinarySearchTree.cs b/DataStructures/BinarySearchTree/BinarySearchTree.cs index 96afd6c2..9a384adb 100644 --- a/DataStructures/BinarySearchTree/BinarySearchTree.cs +++ b/DataStructures/BinarySearchTree/BinarySearchTree.cs @@ -201,7 +201,7 @@ private void Add(BinarySearchTreeNode node, TKey key) // Key is already in tree. else { - throw new ArgumentException($"Key \"{key}\" already exists in tree!"); + throw new ArgumentException($"""Key "{key}" already exists in tree!"""); } } diff --git a/DataStructures/RedBlackTree/RedBlackTree.cs b/DataStructures/RedBlackTree/RedBlackTree.cs index e9cd0c30..3c361920 100644 --- a/DataStructures/RedBlackTree/RedBlackTree.cs +++ b/DataStructures/RedBlackTree/RedBlackTree.cs @@ -101,7 +101,7 @@ public void Add(TKey key) { addCase = GetAddCase(node); - switch(addCase) + switch (addCase) { case 1: break; @@ -339,7 +339,7 @@ private RedBlackTreeNode Add(RedBlackTreeNode node, TKey key) } else { - throw new ArgumentException($"Key \"{key}\" already exists in tree!"); + throw new ArgumentException($"""Key "{key}" already exists in tree!"""); } }