Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to calc totals - LINQ

Posted on 2013-01-15
4
Medium Priority
?
231 Views
Last Modified: 2013-01-15
private List<Pres_Services_GetResult> _serviceItems

later on _serviceItems gets filled

once it is filled, how can I say "give me the TOTAL of <<some column>>"?

Using LINQ but am a noob to LINQ.
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1000 total points
ID: 38779465
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 38779555
Does the article cover this:

 _serviceItems.Sum(o => o.BidAmt);


where BidAmt is a string and comes in as "$115.23" ??
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 1000 total points
ID: 38779632
You'll need to convert that value to a numerical type before summing.

e.g.

_serviceItems.Select(o => decimal.Parse(o.BidAmt, NumberStyles.Currency))
             .Sum(o => o);

Open in new window

0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 38779654
Thanks guys!  : )
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question