Implicitly casting IEnumerable(Of T) to List(Of T) should either be a compile time error or call ToList() on the input sequence.
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
If I write this code:
```
Dim list As New List(Of String)
list = List.OrderBy(Function(q) q)()
```
Then I get a rather cryptic runtime error about a "state machine". The actual problem is that I'm trying to implicitly cast an `IEnumerable(Of String)` to a `List(Of String)`. But why should this be a runtime error? Can't it be a compile time error, same as any other invalid conversion? This is how C# behaves. Or if you want to be more VB-paradigmatic, why not call `ToList()` on the sequence implicitly when this cast is performed? At the very least, if it has to be a runtime error, why can't the error message be clearer, saying something about an invalid cast from `IEnumerable(Of T)` to `List(Of T)`, rather than some sort of state machine?
Thanks! 🙂
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.