Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth
Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

42,845 questions

55,674 answers

573 users

How to use Array.Sort() method to sorts the elements in 1D Array in VB.NET

2 Answers

0 votes
Module Module1

    Sub Main()

        Dim arr As String() = {"hhh", "ccc", "ggg", "bbb", "eee", "aaa", "ddd"}

        Array.Sort(arr, 1, 3)

        Console.WriteLine("arr: {0}", String.Join(", ", arr))

    End Sub

End Module

' run:
' 
' arr: hhh, bbb, ccc, ggg, eee, aaa, ddd

 



answered May 1, 2016 by avibootz
0 votes
Public Class ReverseComparer : Implements IComparer
    Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
        Return New CaseInsensitiveComparer().Compare(y, x)
    End Function
End Class

Module Module1

    Sub Main()

        Dim arr As String() = {"hhh", "ccc", "ggg", "bbb", "eee", "aaa", "ddd"}

        Dim revComparer As New ReverseComparer()

        Array.Sort(arr, 1, 4, revComparer)

        Console.WriteLine("arr: {0}", String.Join(", ", arr))

    End Sub

End Module

' run:
' 
' arr: hhh, ggg, eee, ccc, bbb, aaa, ddd

 



answered May 1, 2016 by avibootz
...