What is the significance of the KeyValuePair<TKey, TValue> structure in Dictionary?
KeyValuePair<TKey, TValue> represents a single item in a dictionary — a key-value
pair.
Used in:
- Iteration
- LINQ queries
- Return values from dictionary enumerators
Example:
foreach (KeyValuePair<string, int> entry in dictionary)
Console.WriteLine($"Key: {entry.Key}, Value: {entry.Value}");