VB.NET:以下列表是否会正确填充?

时间:2011-01-09 18:51:16

标签: .net vb.net

我现在无法访问VB.NET,因此我无法测试此值:

Dim lst As New List(Of String)(cookieValue.Split("$"c))

我从另一个问题得到了这个,但是想知道是否A.列表将正确填充和B. c表示什么?

2 个答案:

答案 0 :(得分:1)

是的,它会。 它将字符串数组传递给List(IEnumberable<T>) constructor

"$"ccharacter literal

答案 1 :(得分:0)

    'test string
    Dim ipsum As String = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

    'split based on a string
    Dim lst_str As New List(Of String)(Strings.Split(ipsum, "in"))

    'split based on a char
    Dim lst_chr As New List(Of String)(ipsum.Split(New Char() {"$"c}, StringSplitOptions.RemoveEmptyEntries))