Pivot in LINQ using lambda expression -


I'm writing lambda in linq to get pivoted data from the resulting list. To get the pivot column, I'm setting a condion to get the value. Here the problem is getting the default value, where the console fails. I do not want a column where the condition fails. I should help

  var query = dataList .GroupBy (c => c.ip.address). Select (G => New {IPAddress = g.Key, AssetType = G. Element at or Default (0) .AssetTypeName, AssetName = g.ElementAtOrDefault (0) .AssetName, // If the status fails I do not need this column, // is also giving C.D.S.Name == "active call", how to get dynamically ** ActiveCol = g.Where (c => c.DesName == "Active call") .Sum (c => c.CurrentValue), ** ** holdcall = g.Where (c => "CALL call"). Yoga (C = & Gt; c. Currentvalue), ** ** CPU = g.Where (c => c.DsName == "CPU"). Yoga (C = & gt; C.CurrentValue), **});  

Why not only create a value to maintain yoga and then a type Specify the second column, in this way you do not have to deal with the empty columns (the assumption is that only one type is valid at one time.)

  value = g SUM (C => c.CurrentValue), // value specified by the DSNN property. DsName = c.DsName  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -