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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:37:38+00:00 2026-05-28T05:37:38+00:00

I have to complete a project but I have a simple problem I have

  • 0

I have to complete a project but I have a simple problem

I have a class defined in this way

using System;
using System.Collections;
using System.Collections.Generic;

..

public class GroupId: XmlDataTransferObject, IEnumerable
{
    private IList _groupId;
    private string _nameId;

    public GroupId() : this("GroupId", "Id")
    {
    }

    public GroupId(string rootName, string nomeId) : base(rootName)
    {
        _groupId = new ArrayList();
        _nomeId = nomeId;
    }

    public override bool IsNull
    {
        get { return _groupId.Count == 0; }
    }

    public int Count
    {
        get { return _groupId.Count; }
    }

    public int Add(Intero i)
    {
        return _groupId.Add(i);
    }

    public Intero this[int index]
    {
        get { return (Intero)_groupId[index]; }
        set { _groupId[index] = value; }
    }
...

            public IEnumerator GetEnumerator()
            {
                    return _groupId.GetEnumerator();
            }
}

}

and I need to find the intersection between an instance of two GroupId objects.

Why can’t I see in the available methods the Linq Intersect even if I have declared the statement:

Using System.Linq 

...

var x = _groupId1.Intersect(_groupId2);

...

Error 1 ‘….GroupId’ does not contain a definition for ‘Intersect’ and no extension method ‘Intersect’ accepting a first argument of type ‘…GroupId’ could be found (are you missing a using directive or an assembly reference?)

  • 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-28T05:37:39+00:00Added an answer on May 28, 2026 at 5:37 am

    Your GroupId class only implements the non-generic IEnumerable class – you should implement IEnumerable<T> if you want to use the LINQ extension methods. (It’ll generally be a better experience anyway.)

    Note that that will also be easier if you use a generic IList<T> instead of the non-generic IList – basically try to avoid the non-generic collections entirely in new code, if at all possible.

    You could use Cast to convert your IEnumerable to IEnumerable<T> like this:

    var x = _groupId1.Cast<Intero>().Intersect(_groupId2.Cast<Intero>());
    

    … but it would be much nicer to just make your class implement IEnumerable<Intero>.

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

Sidebar

Related Questions

I trying to complete a RPG game for a project, but have no idea
My project that I've spent almost 40hrs on is almost complete, but I have
We have just completed implementing a successful but problematic project. We want to get
Have recently been given a project to complete which uses XML quite extensively.Am looking
I'm starting a personal project, so I have at the moment complete architectural/design control.
I have completed a simple database for a project. Only 6tables. Of the 6,
I have a Windows CE device that we are deploying, but we have complete
Excuse the title, but it's best I just explain the problem. I have 2
I actually have two questions regarding the same problem but I think it is
developers! I have very strange problem. My project has DLL writen in C++ and

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.