Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6060423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:49:26+00:00 2026-05-23T08:49:26+00:00

I have a list (i.e. Dim nList as new List(of className) ). Each class

  • 0

I have a list (i.e. Dim nList as new List(of className)). Each class has a property named zIndex (i.e. className.zIndex). Is it possible to sort the elements of the list by the zIndex variable in all of the elements of the list?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:49:26+00:00Added an answer on May 23, 2026 at 8:49 am

    Assuming you have LINQ at your disposal:

    Sub Main()
        Dim list = New List(Of Person)()
        'Pretend the list has stuff in it
        Dim sorted = list.OrderBy(Function(x) x.zIndex)
    End Sub
    
    Public Class Person
        Public Property zIndex As Integer
    End Class
    

    Or if LINQ isn’t your thing:

    Dim list = New List(Of Person)()
    list.Sort(Function(x, y) x.zIndex.CompareTo(y.zIndex))
    'Will sort list in place
    

    LINQ offers more flexibility; such as being able to use ThenBy if you want to order by more than one thing. It also makes for a slightly cleaner syntax.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have List (of class). having 1800 of count and each object has 90
I have a list like this Dim emailList as new List(Of String) emailList.Add(one@domain.com) emailList.Add(two@domain.com)
If I have a list... dim l as List(of MyClass) = new List(of MyClass)
I have a list: Dim list As New List(Of String) with the following items:
I have the following list Dim ordersToUpdate as New List(Of OrderUpdate) I am using
I have an integer list ''# VB Dim ResultIDsas List(Of Integer) = new List(Of
I have List I want to sort Desc by Priority, which is int and
I have List with n items. I wish transform my list to new list,
I have list in python which has following entries name-1 name-2 name-3 name-4 name-1
I have a list of strings. For each string in that list, I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.