Is it possible to do a For…Each Loop Backwards?

前端 未结 13 2197
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 03:53

I don\'t believe this is possible by conventional methods, but something like this verbose code:

For Each s As String In myStringList Step -1
    //\' Do stu         


        
13条回答
  •  无人及你
    2020-12-06 04:44

    Testig in Framework 4, the code

    For Each s As String In myStringList.Reverse
        //' Do stuff here
    Next
    

    it wasn't working, the right way to do it is:

    myStringList.Reverse() ' it is a method not a function
    For Each s As String In myStringList
    //' Do stuff here
    Next
    

    Look at: MSDN: Reserve

提交回复
热议问题