Need an API to get the collection 'element/iteration' type #77926
Labels
api-ready-for-review
API is ready for review, it is NOT ready for implementation
Area-IDE
Concept-API
This issue involves adding, removing, clarification, or modification of an API.
Feature Request
untriaged
Issues and PRs which have not yet been triaged by a lead
Background and Motivation
The IDE has a lot of code for dealing with collection expressions, especially around trying to manipulate them and determine if a change from a non-collection to a collection will be legal. This is challenging as we need to ultimately figure out what the final collection-element type is, and if things like the elements will be legal given that type.
Determining a collection-element type is non trivial. INcluding having to special case a bunch of types. Having to figure out the 'enumerator' pattern if it is there. Having to handle inline arrays. Having to handle spans. Handling IEnumerable, etc. etc.
THe IDE has hacked up a bunch of heuristics. But we really need a concrete way of answering this for real.
Proposed API
Either:
The latter approach is there as it currently isn't clear to me from examination of the existing code for figuring this out if:
Need help from compiler if we need to go the latter route to truly answer this question.
--
Note: this likely will utilize
roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
Line 1702 in b570dc0
The text was updated successfully, but these errors were encountered: