Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Support custom indexers in interfaces #2033

Open
Grimelios opened this issue Sep 13, 2024 · 0 comments
Open

[Enhancement] Support custom indexers in interfaces #2033

Grimelios opened this issue Sep 13, 2024 · 0 comments

Comments

@Grimelios
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant