Converting a list of encodings to some sort of array in vb.net?
I want to loop through all the items in the items, but first I must to cast to appropriate type which I fail.
' Dim arr As EncodingInfo
开发者_开发技巧 Dim arr As List(Of Encoding) = DirectCast(System.Text.Encoding.GetEncodings(), List(Of Encoding))
' Error 1 Value of type '1-dimensional array of System.Text.EncodingInfo'
' cannot be converted to 'System.Collections.Generic.List(Of System.Text.Encoding)'.
something like:
Dim arr As List(Of Text.EncodingInfo) = System.Text.Encoding.GetEncodings().ToList
should work
精彩评论