using System.Collections.Generic;
SortedList<string, int> l = new(new RomanNumeralComparer())
public class RomanNumeralComparer : IComparer<string>
private readonly string _order = "IVXL";
public int Compare(string? x, string? y)
if (x is null && y is null)
int xRank = _order.IndexOf(x, StringComparison.InvariantCulture);
int yRank = _order.IndexOf(y, StringComparison.InvariantCulture);
return (xRank < yRank) ? -1 : (xRank == yRank) ? 0 : 1;