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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:30:13+00:00 2026-05-20T07:30:13+00:00

I have an EF model from which I select a sub-set of data to

  • 0

I have an EF model from which I select a sub-set of data to present in ASP.NET. When I am presenting this output I loop through the returned objects. I would like to know when I am presenting the object with the highest value (to format it differently).

ObjectTable
Category  Item Value
X         A    1.0
X         B    14.0
X         C    9.0
Y         D    18.0

I can return the items I want to view with:

var obj = from o in ObjectTable where Category=="X" select o;

I want to know that B has the highest value.

I am very flexible with how this happens I just haven’t been able to come up with a sensible solution. Should I modify the LINQ statement to add a LET statement creating an obj.IsMax variable and if o.Value==o.Max make it TRUE and all other objects as FALSE, if so how? This route seems like it would be expensive?

Or could I extend the EF Model with a partial class and somehow calculate whether the model value is equal to the max value of the returned objects?

Or something completely different?

  • 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-20T07:30:13+00:00Added an answer on May 20, 2026 at 7:30 am
    var obj  = (ObjectTable.Where(o => o.Category == "Y"));
    var anonymousObjList = obj.Select(o => new {o, IsMax = (o.Value == obj.Max(x => x.Value))});
    

    And looping thru anonymousObjList

    foreach(var obj in anonymousObjList)
    {
        var actualObject = obj.o;
        var isMax = obj.IsMax;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on asp.net application and I have generated entity model (edmx) from
I have a model where I select the proper data from database as below:
In my application, we have a view model object from which we're retrieving its
I have two classes (MVC view model) which inherits from one abstract base class.
I have a simple model class (Part), which pulls from it's information from a
I have a custom model binder which pulls an implementation of an interface from
I have a view model coming from the server as json like this {
The problem: I often need to select a set of variables from a data.frame
I have a select box, from which I want to remove selected choice with
I have created an entity data model from my database. however in certain areas

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.