I have a c# linq assignment to add a data from the csv file, here is my code:

        struct DailyValues
            public DateTime Date { get; private set; }
            public decimal Open { get; private set; }
            public decimal High { get; private set; }
            public decimal Low { get; private set; }
            public decimal Close { get; private set; }
            public decimal Volume { get; private set; }
            public decimal AdjClose { get; private set; }

            public DailyValues(DateTime date, decimal open, decimal high, decimal low,
                decimal close, decimal volume, decimal adjClose)
                : this()
                Date = date;
                Open = open;
                High = high;
                Low = low;
                Close = close;
                Volume = volume;
                AdjClose = adjClose;

            public override string ToString()
                return string.Format("O:{0} / H:{1} / L:{2} / C:{3} / V:{4} / AC:{5} / {6:d}",
                        Open, High, Low, Close, Volume, AdjClose, Date);

            // reads stock values from csv file into a List
            public static List<DailyValues> GetStockValues(string filePath)
                List<DailyValues> values = new List<DailyValues>();

                // TODO: add the data from the csv file

                string[] rows = filePath.Replace("\r", "").Split('\n');
                foreach (string row in rows)
                    if (string.IsNullOrEmpty(row)) continue;
                    string[] cols = row.Split(',');
                    DailyValues v = new DailyValues();

                    v.Open = Convert.ToDecimal(cols[0]);
                    v.High = Convert.ToDecimal(cols[1]);
                    v.Low = Convert.ToDecimal(cols[2]);
                    v.Close = Convert.ToDecimal(cols[3]);
                    v.Volume = Convert.ToDecimal(cols[4]);
                    v.AdjClose = Convert.ToDecimal(cols[5]);
                    v.Date = Convert.ToDateTime(cols[6]);


                return values;

And when I compile it shows me command
Can anyone help me out give me some hint where did i did wrong? I would be very appreciate that!

4 Years
Discussion Span
Last Post by Momerath

Where are you reading the file? I see you changing the path, but not actually reading any data from the file. And why do you change the path?

Edited by Momerath

This topic has been dead for over six months. 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.