When i run the below query by LINQ PAD then saw it was showing sum at the end of result. here is the full code and it is working.
void Main()
{
var csvlines = File.ReadAllLines(@"M:\smdr(backup08-06-2015).csv");
var csvLinesData = csvlines.Skip(1).Select(l => l.Split(',').ToArray());
// i am assuming that line[7] is the Party1Name Column
// now you have a (sorted) group with n "members" (ACC, Sales, ..., n )
var groupOfUser = from line in csvLinesData
where !line[12].Contains("VM") && !line[12].Contains("Voice Mail")
group line by line[12] into newGroup
orderby newGroup.Key
select newGroup;
// The Key of your userOfGrp is the Name e.g. "ACC"
// i am assuming that x[4] is the direction Column
// I count all I or O and put them into the new User
var user = (from userOfGrp in groupOfUser
select
new User()
{
CSRName = userOfGrp.Key,
Incomming = userOfGrp.Count(x => x[4] == "I"),
Outgoing = userOfGrp.Count(x => x[4] == "O")
}).ToList();
user.Dump();
}
class User
{
public string CSRName;
public int Outgoing;
public int Incomming;
public int calltransfer;
}
i just like to know is it feature of linq pad which always show sum at end when field type is numeric ? or something is there in my linq query which showing sum.
i am asking because just started to use linq. thanks
my screen shot attached.i also put arrow in image to indicate which area i am talking about.
LINQad will return results in its Results tab, any enumeration will have at the top of its blue box something like:
Depending on the exact type. That count at the end is a LINQPad feature when it serializes the data for display, and it is the count not the sum.
EDIT: Now I can see a picture of the results you are talking about something different, yes that is also a LINQPad feature (and the sum).