Beef icon indicating copy to clipboard operation
Beef copied to clipboard

[Enhancement] Support custom indexers in interfaces

Open Grimelios opened this issue 1 year ago • 0 comments

Beef currently doesn't support custom indexers defined in interfaces, as shown below:

public interface IIndexable<T>
{
    T this[int index] { get; set; }
}

public static void Get<T>(T indexable) where T : IIndexable<float>
{
    // This fails!
    float f = indexable[0];
}

The same functionality can be achieved using ref T Index(int index); in the interface, but a traditional indexer would probably be preferable to most users.

Grimelios avatar Sep 13 '24 16:09 Grimelios