Пример #1
0
        public void Parse()
        {
            StreamReader file = new StreamReader(path);

            //Przypisz header
            if (!file.EndOfStream)
            {
                header = new CSVRecord(file.ReadLine().Split(','));
            }

            //Przypisz rekordy
            while (!file.EndOfStream)
            {
                try
                {
                    records.Add(new CSVRecord(file.ReadLine().Split(',')));
                }
                catch (ArgumentOutOfRangeException e)
                {
                    Console.WriteLine(e.Message);
                }
                catch (ArgumentException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            file.Close();
            colCount       = records[0].Length;
            colDescription = records[0].ToArray();
        }
Пример #2
0
        //Value equal method
        public override bool Equals(object obj)
        {
            //Console.WriteLine("Wchodzimy w equals!");
            CSVRecord eq_obj = obj as CSVRecord;

            if (eq_obj == null)
            {
                return(false);
            }

            for (int i = 0; i < recordFields.Length; i++)
            {
                if (recordFields[i] != eq_obj.recordFields[i])
                {
                    return(false);
                }
            }
            return(true);
        }