The indexer syntax on IEnumerable using the extension block is not functioning correctly in .NET 10 Preview 3 #9322
-
public static class Enumerable
{
extension<TSource>(IEnumerable<TSource> source)
{
public TSource this[Index index] => source.ElementAt(index);
}
}
int[] values = [1, 2, 3];
var items = values.AsEnumerable();
var item = items[0]; // Not working
var item2 = Enumerable.get_Item(items, 0); // Works Please ensure this is resolved before the stable release. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
As of C# 14 preview 3 only methods and properties have been implemented. Indexers and other member types will come in a future release. |
Beta Was this translation helpful? Give feedback.
-
Closing as this has been answered. If you want certain capabilities that didn't merge into the release you're using, you can cut a release of roslyn yourself and use the compiler you build. You can then target any of our branches and even try things out in an individual dev's branches as they are literally developing them. |
Beta Was this translation helpful? Give feedback.
See: https://github.com/dotnet/core/blob/main/release-notes/10.0/preview/preview3/csharp.md#extension-members
As of C# 14 preview 3 only methods and properties have been implemented. Indexers and other member types will come in a future release.