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

  • Home
  • SEARCH
  • 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 7882851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:22:58+00:00 2026-06-03T04:22:58+00:00

Fruit[] data = new[] { new Fruit {Name = Gala,Type = Apple,Price = 0.75m,Quantity

  • 0
 Fruit[] data = new[] {
                new Fruit {Name = "Gala",Type = "Apple",Price = 0.75m,Quantity = 10}, 
                new Fruit {Name = "Granny Smith",Type = "Apple",Price = 0.80m,Quantity = 7},
                new Fruit {Name = "Tasty",Type = "Strawberries",Price = 1.90m,Quantity = 20}
                       };

 var grouped = from fruit in data
                          group fruit by fruit.Type;

grouped type is : System.Linq.GroupedEnumerable<ConsoleApplication15.Fruit,string,ConsoleApplication15.Fruit>

have a look on it : enter image description here

my question :

if grouped contains items ( implements ienumerable ) – why its type is GroupedEnumerable

and not

IEnumerable <System.Linq.IGrouping<string,ConsoleApplication15.Fruit>>

why did they create a new Type aka GroupedEnumerable ?

  • 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-03T04:22:59+00:00Added an answer on June 3, 2026 at 4:22 am

    If you have an object in .Net, it has to be of some concrete type, it can’t be an interface. So, for example, new IList<int>() is not valid, you have to do something like new List<int>().

    If you have a variable, its type can be an interface, so you can write, for example, IList<int> list = new List<int>().

    And that’s exactly what’s happening here. The type of the variable grouped is IEnumerable<IGrouping<string,Fruit>> (although it’s not clear from the code, because you’re using var). The type of the object referenced by that variable is GroupedEnumerable<Fruit, string, Fruit>, which is an internal type used by the implementation of GroupBy(). It can’t be IEnumerable, because you can’t have an instance of an interface.

    The Visual Studio debugger is showing you the runtime type of the object, because that’s what debugger is for: to show you the runtime information.

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

Sidebar

Related Questions

For my question lets consider the following sample table data: ProductID    ProductName    Price   Category 1                Apple                 5.00       Fruits
I have an array $data fruit => apple, seat => sofa, etc. I want
I have a form: <form name='inputform' method='post' action='fruit.php?action=add&fruit_id=5' enctype='multipart/form-data'> But after the submit, it
I have class Fruit with data and logic. Now I need a lot of
member purchase fruit 1 1 apple 1 2 apple 1 3 banana 1 4
Say I have three tables: Fruit (Table 1) ------ Apple Orange Pear Banana Produce
Take the following create table statement: create table fruit { count int, name varchar(32),
I am trying to achieve a functionality so that new data appears in new
enum Fruit { Banana, Orange, Strawberry ... ... // etc, very long enum }
Public Enum Fruit Red_Apple = 1 Oranges Ripe_Banana End Enum Private Sub InitCombosRegular() Dim

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.