コード例 #1
0
        public bool Read(out string column1, out string column2)
        {
            if (_reader == null)
            {
                throw new NullReferenceException("The reader cannot be used anymore. Pleaser reinitializate it.");
            }

            const int firstColumn  = 0;
            const int secondColumn = 1;

            var line = _reader.ReadLine();

            //Default values
            column1 = null;
            column2 = null;

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

            var columns = line.Split('\t');

            //There is always at least 1 element in the array
            column1 = columns[firstColumn];
            if (columns.Length > 1)
            {
                column2 = columns[secondColumn];
            }

            return(true);
        }
コード例 #2
0
 public static Generic.IEnumerable <Tasks.Task <string> > ReadAllLines(this ITextReader me)
 {
     Tasks.Task <string> result;
     while ((result = me.ReadLine()).NotNull())
     {
         yield return(result);
     }
 }