A dictionary maps keys to values for fast lookup by name.

Dictionary Lookup

DictionaryLookup.cs
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        string key = ;
        Dictionary<string, int> scores = new Dictionary<string, int>
        {
            ["csharp"] = 94,
            ["go"] = 88
        };
        bool found = scores.ContainsKey(key);
        int value = found ? scores[key] : 0;

        Console.WriteLine($"key={key}");
        Console.WriteLine($"found={found}");
        Console.WriteLine($"value={value}");
    }
}
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        string key = ;
        Dictionary<string, int> scores = new Dictionary<string, int>
        {
            ["csharp"] = 94,
            ["go"] = 88
        };
        bool found = scores.ContainsKey(key);
        int value = found ? scores[key] : 0;

        Console.WriteLine($"key={key}");
        Console.WriteLine($"found={found}");
        Console.WriteLine($"value={value}");
    }
}
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        string key = ;
        Dictionary<string, int> scores = new Dictionary<string, int>
        {
            ["csharp"] = 94,
            ["go"] = 88
        };
        bool found = scores.ContainsKey(key);
        int value = found ? scores[key] : 0;

        Console.WriteLine($"key={key}");
        Console.WriteLine($"found={found}");
        Console.WriteLine($"value={value}");
    }
}
dictionary A dictionary stores key-value pairs.