private void populateMaxOrMinValue(DataTable dtRef)
{
if (dtRef.Rows.Count > 0)
{
//////////PICK THE MAX VALUE FROM DATATABLE USING ENUMERABLE
maxValue = dtRef.AsEnumerable()
.Where(ss => double.TryParse(ss["value"].ToString(), out val))
.Select(ss => Convert.ToDouble(ss["value"])).Max();
//////////PICK THE MIN VALUE FROM DATATABLE USING ENUMERABLE
minValue = dtRef.AsEnumerable()
.Where(ss => double.TryParse(ss["value"].ToString(), out val))
.Select(ss => Convert.ToDouble(ss["value"])).Min();
//////////////////////////////////////////////
}
}
No comments:
Post a Comment