开发者

Converting a list of encodings to some sort of array in vb.net?

开发者 https://www.devze.com 2023-04-03 09:26 出处:网络
I want to loop through all the items in the items, but first I must to cast to appropriate type which I fail.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消