Thursday 4 September 2014

Averaging DataTable Columns Value in C#

  //int iCount1 = _dtRainfall.AsEnumerable()
                        //                      .Where(s => s.Field<bool>("Select").Equals(true)).Count();
                     

                        double avgElevationValue = _dtRainfall.AsEnumerable()
                                                 .Where(s => s.Field<bool>("Select").Equals(true))
                                                 .Average(x => Convert.ToDouble(x.Field<string>("Elevation")));


Count and Avg Value of Columns

No comments:

Post a Comment