1
Answer

How to get an Not Empty Instance back ?

Abdalla Omran

Abdalla Omran

5y
495
1
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)