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 3632842
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:34:36+00:00 2026-05-19T00:34:36+00:00

I have a list of lists as below: List<List <T> > userList Class T

  • 0

I have a list of lists as below:

List<List <T> > userList

Class T { string uniqueidentifier, string param2, int param2}

I have a uniqueidentifier and i need to find the element T in the list that has the same ‘uniqueidentifier’ value.

I can do it using two ‘foreach’ loops. This does not seem to be nice way doing things. I guess there should be some inbuilt method like ‘Find’ that does the same thing and is highly optimized.

  • 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-19T00:34:37+00:00Added an answer on May 19, 2026 at 12:34 am

    Find is not optimized at all — it performs a linear search, since that’s the only thing that makes sense on an unsorted list. If you are looking at a nicer way to write it, you could use LINQ:

    var element = (from sublist in userList
                   from item in sublist
                   where item.uniqueidentifier == someid
                   select item).FirstOrDefault();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to groovy Lists, and I have list as shown below: Class
I have a (python) list of lists as below biglist=[ ['1','123-456','hello','there'],['2','987-456','program'],['1','123-456','list','of','lists'] ] I need
I have a list (see below) contained in a window. The window's DataContext has
I have a standard list view setup with backbone that looks something like below.
Form contains two dropdown lists created using code below. Both dropdown list elements have
I have a list of keywords like below and some keyword lists in the
Have Addresse s and List s with many-to-many relationship, as shown below. Sometimes need
I have two lists see below.....result is coming back as empty List<Pay>olist = new
I have a list of table elements under element named Query that may duplicate,
I have a nested list like below (but it has 1,000's of the holder

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.