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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:14:32+00:00 2026-05-27T12:14:32+00:00

I have custom type name Netsgroup which is a collection of Net class. Net

  • 0

I have custom type name Netsgroup which is a collection of Net class.

Net class , contsains: Netname and list of string Parts.

class Netsgroup:  CollectionBase
{
 // a collection of nets
    public Net[] nets
    {
        get { return (Net[]) this.InnerList.ToArray(typeof(Net)); }
    }
}

public class Net
{

    string netname;
    public string Netname
    {
        get { return netname; }
        set { netname = value; }
    }


   List<string> parts= new List<string>();
    public  List<string> Parts
    {
        get { return parts; } 
    }
}

An example of Netsgroup is:

Net1 u1, u2, u3

Net2 u4,u5,u3

Net3 u4,u6, u7

Each line is with Netname and Parts.

I want to find the duplicates in the Netsgroup collection.

Like:

net1, net2 has u3

net2, net3 has u4

How can I intersect the Parts from all Nets to find duplicates?

Thanks, Avi.

  • 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-27T12:14:33+00:00Added an answer on May 27, 2026 at 12:14 pm

    I think doing this would be easiest using LINQ:

    var duplicates =
        from net in netsgroup.nets
        from part in net.Parts
        group net by part into g
        where g.Count() >= 2
        select g;
    

    If you want to write the results in the format you specified into console, you can use something like:

    foreach (var dup in duplicates)
        Console.WriteLine(
            "{0} has {1}", string.Join(", ", dup.Select(n => n.Netname)), dup.Key);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some custom type: [RdfSerializable] public class Item { [RdfProperty(true)] public string Name
i have a list of Elemtents of a custom type: std::list<CDataTransferElement*> m_list; The class
I have a custom c# type like (just an example): public class MyVector {
I have defined a custom list template type for SharePoint . I install it
I have a custom UserControl which has a DependencyProperty ItemTemplate of type DataTemplate. I
I have a custom exception class which contains some additional fields. I want these
I have a List<> of custom objects. This custom type has a property called
I have a custom content type which has a field called location which is
For example if i have to create custom list view about type of food,
If you have custom type, and you wish to assign a List(of T) to

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.