I have this class that inherits from a list:
Public Class TextLines : Inherits List(Of String)
End Class
Now, how I can cast a return value of type IEnumerable(Of String)
to my custom Class?
Real example of what I'm trying to do:
Dim lines As TextLines
lines = CType(File.ReadAllLines(Me.filepathB, Me.encodingB).ToList, TextLines)
It throws an invalid cast exception.
Why don't you just do this?
or expose the constructor that takes the
IEnumerable<T>
?