.NET 6 added a long-missing collection to the base class library: PriorityQueue<TElement, TPriority>. A priority queue is useful when you do not want to process items in the order they were inserted, but in the order of their priority. Typical examples include job scheduling, pathfinding, graph algorithms, simulations, message processing,…
-
-
SortedSet in .NET manages ordered, unique elements using a custom comparer that defines both sorting order and element uniqueness. A common pitfall occurs when two different instances with the same value are treated as duplicates. To avoid this, a tie-breaker is needed, ensuring both order and distinctness among elements.
-
File I/O looks like one of those things that cannot be unit-tested properly. A method that reads directories, scans files, compares extensions, and deletes files seems tied to the real machine where the test is running. That creates all the usual problems: tests become slow, fragile, dependent on local paths,…