diff --git a/csharp-algorithms/CountingSort/CountingSort/CountingSort.csproj b/csharp-algorithms/CountingSort/CountingSort/CountingSort.csproj
index 79e7148fd0..62be4f867f 100644
--- a/csharp-algorithms/CountingSort/CountingSort/CountingSort.csproj
+++ b/csharp-algorithms/CountingSort/CountingSort/CountingSort.csproj
@@ -2,13 +2,13 @@
Exe
- net6.0
+ net10.0
enable
enable
-
+
diff --git a/csharp-algorithms/CountingSort/CountingSort/CountingSortBenchmarks.cs b/csharp-algorithms/CountingSort/CountingSort/CountingSortBenchmarks.cs
new file mode 100644
index 0000000000..65e815bd71
--- /dev/null
+++ b/csharp-algorithms/CountingSort/CountingSort/CountingSortBenchmarks.cs
@@ -0,0 +1,43 @@
+using BenchmarkDotNet.Attributes;
+
+namespace CountingSort;
+
+public class CountingSortBenchmarks
+{
+ private readonly CountingSortMethods _sorter = new();
+ private int[] _source = [];
+ private int[] _work = [];
+
+ [Params("Best Case", "Average Case", "Worst Case")]
+ public string Input { get; set; } = "Average Case";
+
+ [GlobalSetup]
+ public void Setup()
+ {
+ _source = Input switch
+ {
+ "Best Case" => CountingSortMethods.CreateRandomArray(20_000, 1, 2),
+ "Average Case" => CountingSortMethods.CreateRandomArray(20_000, 10_000, 30_000),
+ _ => CountingSortMethods.CreateImbalancedArray(
+ CountingSortMethods.CreateRandomArray(19_999, 10_000, 30_000))
+ };
+ _work = new int[_source.Length];
+ }
+
+ [Benchmark]
+ public int[] CountingSort()
+ {
+ _source.CopyTo(_work, 0);
+
+ return _sorter.CountingSort(_work);
+ }
+
+ [Benchmark(Baseline = true)]
+ public int[] ArraySort()
+ {
+ _source.CopyTo(_work, 0);
+ Array.Sort(_work);
+
+ return _work;
+ }
+}
diff --git a/csharp-algorithms/CountingSort/CountingSort/CountingSortMethods.cs b/csharp-algorithms/CountingSort/CountingSort/CountingSortMethods.cs
index 7bcf4bc92c..c469f89235 100644
--- a/csharp-algorithms/CountingSort/CountingSort/CountingSortMethods.cs
+++ b/csharp-algorithms/CountingSort/CountingSort/CountingSortMethods.cs
@@ -1,79 +1,86 @@
-using BenchmarkDotNet.Attributes;
+namespace CountingSort;
-namespace CountingSort
+public class CountingSortMethods
{
- public class CountingSortMethods
+ public int[] CountingSort(int[] array)
{
- public IEnumerable