Example #1
0
        public static ArrayList MakeTestData(int count, IDataReadble readble)
        {
            ArrayList xList = new ArrayList();

            for (int i = 0; i < count; i++)
            {
                xList.Add(readble.MakeTestData());
            }
            return(xList);
        }
Example #2
0
        public static ArrayList Read(
            IDataReader reader,
            IDataReadble readble,
            Nullable <int> skipNoFirstRows,
            Nullable <int> maxRows,
            out int totalRows)
        {
            ArrayList xList = new ArrayList();

            totalRows = 0;
            int readRows = 0;

            while (reader.Read())
            {
                bool doRead = true;

                if (skipNoFirstRows != null)
                {
                    if (totalRows < skipNoFirstRows) // both are zero-based
                    {
                        doRead = false;
                    }
                }


                if (maxRows != null)
                {
                    if (readRows >= maxRows) // the quota was reached the lap before
                    {
                        doRead = false;
                    }
                }

                if (doRead)
                {
                    xList.Add(readble.Read(reader));
                    readRows++;
                }

                totalRows++;
            }

            reader.Close();

            return(xList);
        }