Help desk ticket lookup with a dictionary
The requirement is to open a specific player report quickly when a support specialist receives its ID. The report log can still be useful for display, but it is not a good index for lookup.
The C# solution
var reportsById = new Dictionary<string, Ticket>
{
["GS-2042"] = new("GS-2042", "Player cannot join a match", 2, null),
["GS-2043"] = new("GS-2043", "Season reward missing", 3, null)
};
if (reportsById.TryGetValue("GS-2042", out Ticket? report))
{
Console.WriteLine(report.Title);
}
What works
A dictionary uses the player-report ID as a key, so the common “find this exact report” operation is usually O(1). TryGetValue also makes a missing ID explicit instead of throwing for an ordinary lookup miss.
The limitation that remains
A dictionary does not by itself prevent the same match event from being processed twice, and it is not a priority ordering. It also cannot store two different reports under the same ID; the application must decide whether a repeated ID is an update or an error.
The dictionary is the lookup index. It does not replace the report log or record whether an external event was already processed.