Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
LINQ To SQL: Sum operator
WhatsApp
Vijai Anand Ramalingam
13y
14.7
k
0
0
25
Blog
EmpDetails Table:
Code:
To Compute the Sum of Values in a Numeric Sequence
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
LINQ
{
class
Program
{
static
void
Main(
string
[] args)
{
DataClassesDataContext
dc =
new
DataClassesDataContext
();
var
allowance = (
from
emp
in
dc.EmpDetails
select
emp.Allowance).Sum();
Console
.WriteLine(allowance);
Console
.Read();
}
}
}
Output:
24100
Up Next
LINQ To SQL: Order by operator
Ebook Download
View all
Printing in C# Made Easy
Read by 22.3k people
Download Now!
Learn
View all
Membership not found