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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:05:11+00:00 2026-06-14T05:05:11+00:00

I know this very similar question has been asked before quite a few times

  • 0

I know this very similar question has been asked before quite a few times such as in Comparing two collections for equality irrespective of the order of items in them, but I’m trying to use the solutions I’m reading there and something is not working… This HAS to be a stupid mistake I’m making… Please help!!

Ok, so, here’s my scenario, suppose I have the following 3 lists created in code:

Dim lst1 as new list(of integer)
Dim lst2 as new list(of integer)
Dim lst3 as new list(of integer)

And then, within the code I end up with, say, the following values in the lists:

lst1:    lst2:    lst3:
1        1        2
2        2        3
3        3        4
4        4        5

So, obviously, lst1 & lst2 are equal and lst1 & lst3 are not, but what code can I write into my if statement to verify this?

I’ve tried:

lst1.SequenceEqual(lstXX)

And that returns True for both lst2 and lst3
I’ve tried:

lst1.Equals(lstXX)

And that returns False for both lst2 and lst3

Now, I know I could do it with code comparing count and lst1.Except(lstXX), but I’m wondering more so what I’m doing wrong here and even more importantly, what is the most efficient method to do this??

Thanks!!!

  • 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-06-14T05:05:12+00:00Added an answer on June 14, 2026 at 5:05 am

    Assuming you want ordering to be important, SequenceEqual is exactly what you want – and in the sample you’ve given, lst1.SequenceEqual(lst3) will return false. Here’s a short but complete program to demonstrate:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    
    class Test
    {
        static void Main(string[] args)
        {
            var lst1 = new List<int> { 1, 2, 3, 4 };
            var lst2 = new List<int> { 1, 2, 3, 4 };
            var lst3 = new List<int> { 2, 3, 4, 5 };
    
            Console.WriteLine(lst1.SequenceEqual(lst2)); // True
            Console.WriteLine(lst1.SequenceEqual(lst3)); // False
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Now I know this basic question has been asked before, but I must be
I know this question has been asked a couple of times, but there's something
This question is similar to what has been asked earlier but I think memory
This question has been asked here before . The accepted answer was probably obvious
I know that this question is very similar to the question posted here .
I know that this is a repeated question. I have found very similar questions
I know this is very similar to a few other questions, but I can't
guys I know this question is very basic but I've met in few publications
This is very similar to a question I asked the other day but my
This is very similar to a question I asked the other day but my

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.