How do I overload the [] operator in C# [duplicate]

public int this[int key]
{
    get => GetValue(key);
    set => SetValue(key, value);
}

Leave a Comment