.net - Cast IEnumerable(Of String) to my sub-classed List(Of String) -
i have class inherits list:
public class textlines : inherits list(of string) end class now, how can cast return value of type ienumerable(of string) custom class?
real example of i'm trying do:
dim lines textlines lines = ctype(file.readalllines(me.filepathb, me.encodingb).tolist, textlines) it throws invalid cast exception.
why don't this?
dim lines new textlines() lines.addrange(file.readalllines(me.filepathb, me.encodingb)); or expose constructor takes ienumerable<t>?
Comments
Post a Comment