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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:38:35+00:00 2026-06-05T03:38:35+00:00

since this (vb.net) Dim test As New List(Of Integer()) test.Add(New Integer() {1, 2, 3})

  • 0

since this

(vb.net)

    Dim test As New List(Of Integer())
    test.Add(New Integer() {1, 2, 3})
    test.Add(New Integer() {1, 3, 3})
    test.Add(New Integer() {3, 2, 3})
    test.Add(New Integer() {1, 1, 3})
    test.Add(New Integer() {1, 2, 3})
    Dim a = test.Distinct

(c#)

    List<int[]> test = new List<int[]>();
    test.Add(new int[] { 1, 2, 3 });
    test.Add(new int[] { 1, 3, 3 });
    test.Add(new int[] { 3, 2, 3 });
    test.Add(new int[] { 1, 1, 3 });
    test.Add(new int[] { 1, 2, 3 });
    var a = test.Distinct();

does not work, how would you do the distinct?

  • 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-05T03:38:38+00:00Added an answer on June 5, 2026 at 3:38 am

    You have to provide a custom Equality comparer for Distinct to work in this case – otherwise you are comparing references, here’s an initial attempt:

    class SequenceComparer<T,U> : IEqualityComparer<T> where T: IEnumerable<U>
    {
        public bool Equals(T x, T y)
        {
            return Enumerable.SequenceEqual(x, y);
        }
    
        public int GetHashCode(T obj)
        {
            int hash = 19;
            foreach (var item  in obj)
            {
                hash = hash * 31 + item.GetHashCode();
            }
            return hash;
        }
    }
    

    Now you can use this in your call to Distinct():

    var results = test.Distinct(new SequenceComparer<int[],int>())
                      .ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a question about the VB.NET language. Since I am using it every
Similar to this question, but for VB.NET since I learned this is a language
I need to know this since this is a pre-req for .NET 3.5 and
I am some problems since this morning with my Selenium Test. I created a
Solution (kinda): Turns out this impersonation with .NET's security only allows application-level access. Since
Since this function is implemented in IE8, I wanted to see exactly what I
Sorry since this question is specific to my problem. While learning reflections i did
UPDATE : Since this question is getting some views, I figured I'd better highlight
UPDATE 1/31/10 : Since this thread continues to get a lot of views...I am
Edit (2012-04-12): Since this question was asked it is now possible (as of jQuery

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.