Reputation: 29
I am working with LISP expressions in my computer programming (visual basic) course and I have a minor question.
How would I go about reversing a list in vb.net?
For example, if I were to input:
'(H J K L)
I would return an output of:
'(L K J H)
Upvotes: 3
Views: 9239
Reputation: 17680
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()
Upvotes: 5