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: Average Operator
WhatsApp
Vijai Anand Ramalingam
13y
5.8
k
0
0
25
Blog
EmpDetails Table:
Code:
To return the average value from 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
empQuery = (
from
emp
in
dc.EmpDetails
select
emp.Allowance).Average();
Console
.WriteLine(empQuery.Value);
Console
.Read();
}
}
}
Up Next
LINQ To SQL: Sum operator
Ebook Download
View all
Printing in C# Made Easy
Read by 22.3k people
Download Now!
Learn
View all
Membership not found