Abdalla Omran

Abdalla Omran

  • NA
  • 334
  • 32k

How to get an Not Empty Instance back ?

Apr 26 2019 8:42 AM
public static TheQFromDB CalculateMaxVal(List<TheQFromDB> input)
{
TheQFromDB Q = new TheQFromDB();
double maxValue = double.MinValue;
foreach (var item in input)
{
if (item.SecondsDiff > maxValue)
maxValue = item.SecondsDiff;
Q.MaxValue = maxValue;
}
input.Add(Q);
Console.WriteLine(Q.MaxValue);
return Q;
 
in this Ex here i have a List from Type TheQFromDB and insaid (input) several properties one of them is SecondsDiff .. i want get the class TheQfromDB back but with this code iam getting an Empty instance which call here Q . 

Answers (1)