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;
    }

Recommended Answers

All 2 Replies

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

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; }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.