3

我在我的计算机编程(视觉基础)课程中使用 LISP 表达式,我有一个小问题。

我将如何在 vb.net 中反转列表?

例如,如果我要输入:

'(H J K L)

我将返回以下输出:

'(L K J H)
4

1 回答 1

5

if for instance you have a list of strings, you can simple call the Reverse() method which is available for IEnumerable

Dim list = New List(Of String)() From { _
    "item", _
    "item2", _
    "item3" _
}

list.Reverse()

Or if you were dealing with an array of strings it would be as below.

Dim arr = New String() {"kdkd", "dkd"}

Dim reversedArr = arr.Reverse()
于 2015-02-03T23:25:07.873 回答