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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:34:40+00:00 2026-05-27T22:34:40+00:00

My doubt is simple. I’m creating a query using LINQ to ENTITIES. I want

  • 0

My doubt is simple. I’m creating a query using LINQ to ENTITIES.

I want to expose a property where returns the query.

I.E.

public ... GetScores
{
    get { from e in Exams
          select new { .. }
}

I do this to show the data in a datagrid and a graphic. But the problem is I need to especify the datatype like IEnumerable, so at this case T is an class where is anonymous.

Is necessary that I create a class where contains the properties of the query?

Real example

            List<Student> studentList = new List<Student>()
            {
                new Student() { Name="Oscar", ExamResults = new List<float>() {0.8f, 0.75f, 0.6f, 0.95f }},
                new Student() { Name="Juan", ExamResults = new List<float>() {0.4f, 0.6f, 0.7f }},

            };

            var query = from s in studentList
                        select new
                        {
                            Name = s.Name,
                            Avg = s.ExamResults.Average(),
                            Description = string.Format("{0} of {1} accredited.", s.ExamResults.Count(e => e > 0.7f), s.ExamResults.Count)
                        };

public class Student
{
    public string Name {get;set;}
    public List<float> ExamResults { get; set;}

}
  • 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-27T22:34:40+00:00Added an answer on May 27, 2026 at 10:34 pm

    Have you tried:

    public IEnumerable<Object> Query { get { return query; } }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple doubt: I have an external assembly that I want to
I have a simple query doubt. Question Table qid question 1 ques1 2 ques2
No doubt I'm missing something really simple here but I just can't see the
I am in simple doubt... I created the following dictionary: >>> alpha={'a': 10, 'b':
please help me with a simple PHP doubt. I have a simple form: <
I've a simple but confusing doubt about whether the program below runs in exponential
This is a simple and basics but I had a doubt that if it
I'm testing a very simple java application using JUnit 4. By simple I mean
My simple project structure is shown in this link . I am using Eclipse
I want to perform a simple slide motion on an HTML element. JQuery is

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.