0

So I am making an application on visual studios and I wrote a method to return a double after going through a list of data. I printed the list and know its there but the method pretends its not there and returns the code i initialize the variable with. Help? I am a java programmer and don't know much c# so is my syntax wrong? or is my logic just flawed?

public double GetMin()
    {

        double currentMin = 100;
        foreach (GraphData d in newList)
        {

            if (d.Value < currentMin)
            {
                currentMin = d.Value;
            }


        }

        return currentMin - 2.5;
    }
2
Contributors
2
Replies
17
Views
2 Years
Discussion Span
Last Post by Nandomo
0

Where is newList defined? How does it get its data? What is GraphData? How is the Value property of GraphData initialized?

0

defined in the same class.

foreach (DailyPrices p in dailyList) 
        {
            if (p.date.CompareTo(firstDate) >= 0 && p.date.CompareTo(lastDate) <= 0)
            {
                newList.Add(new GraphData(p.date, p.adj_close));

            }
        }

GraphData is an object holding a DateTime variable and a double Value.

public double Value { get; set; }
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.