TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
diamond diamond
NA
133
55.5k
Compute average via linq after group
Oct 24 2014 5:10 AM
Hi
I have a such a code blew, I want after grouping, acquire average of duration variable.
var qry = from dr in dt.AsEnumerable()
group dr by new { source = dr["saddr"] } into rowsGroup
select new
{
saddr = rowsGroup.Key,
value = rowsGroup,
daddr = rowsGroup.Count(),
dport = string.Join(",", rowsGroup.Select(av => av["dport"].ToString()).ToList()),
dstip = string.Join(",", rowsGroup.Select(aj => aj["CDaddr"].ToString()).ToList()),
duration = string.Join(",", rowsGroup.Select(av => av["dur"].ToString()).ToList()),
bytes = string.Join(",", rowsGroup.Select(av => av["bytes"].ToString()).ToList()),
pkt = string.Join(",", rowsGroup.Select(av => av["pkts"].ToString()).ToList())
};
Reply
Answers (
4
)
C# SQL Select from multiple tables
Random number Generator