【发布时间】:2011-11-28 17:22:27
【问题描述】:
下面的代码要求我将字符数组转换为字符串数组,但出现以下错误:Option Strict On disallows implicit conversions from '1-dimensional array of Char' to 'System.Collections.Generic.IEnumerable(Of String)'
Dim lst As New List(Of String)
lst.AddRange(IO.Path.GetInvalidPathChars())
lst.AddRange(IO.Path.GetInvalidFileNameChars())
lst.Add("&")
lst.Add("-")
lst.Add(" ")
Dim sbNewName As New StringBuilder(orignalName)
For i As Integer = 0 To lst.Count - 1
sbNewName.Replace(lst(i), "_")
Next
Return sbNewName.ToString
我尝试通过 Array.ConvertAll 使用转换器,但找不到好的示例,我可以使用循环,但认为会有更好的方法。有人可以帮忙吗?
【问题讨论】:
标签: vb.net .net-2.0 type-conversion converter