一聚教程网:一个值得你收藏的教程网站

热门教程

vb.net 数据排序倒序代码

时间:2022-06-25 05:34:18 编辑:袖梨 来源:一聚教程网

vb.net 数据排序倒序代码

imports system

public class mainclass
   
    shared sub main()
        dim myarray as [string](  ) = {"w", "i", "a", "t"}

        console.writeline("display myarray...")
        displayarray(myarray)

        console.writeline("reverse and display myarray...")
        array.reverse(myarray)
        displayarray(myarray)

        dim myotherarray as [string](  ) = _
          {"e", "l", "s", "t", "o", "b", "f", "v"}

        console.writeline("display myotherarray...")
        displayarray(myotherarray)

        console.writeline("sort and display myotherarray...")
        array.sort(myotherarray)
        displayarray(myotherarray)

    end sub
    public shared sub displayarray(byval thearray(  ) as object)
        dim obj as object
        for each obj in thearray
            console.writeline("value: {0}", obj)
        next obj
        console.writeline(controlchars.lf)
    end sub 'displayarray

end class

热门栏目