コード例 #1
0
        private IDataReader AsDataReader(Action <IDictionary <string, Type> > membersDiscovered)
        {
            ChoCSVRecordReader rr = new ChoCSVRecordReader(typeof(T), Configuration);

            rr.Reader             = this;
            rr.TraceSwitch        = TraceSwitch;
            rr.RowsLoaded        += NotifyRowsLoaded;
            rr.MembersDiscovered += membersDiscovered != null ? (o, e) => membersDiscovered(e.Value) : MembersDiscovered;
            var dr = new ChoEnumerableDataReader(_lines != null ? rr.AsEnumerable(_lines) : rr.AsEnumerable(_textReader), rr);

            return(dr);
        }
コード例 #2
0
        public IEnumerator <T> GetEnumerator()
        {
            ChoCSVRecordReader rr = new ChoCSVRecordReader(typeof(T), Configuration);

            rr.Reader             = this;
            rr.TraceSwitch        = TraceSwitch;
            rr.RowsLoaded        += NotifyRowsLoaded;
            rr.MembersDiscovered += MembersDiscovered;
            var e = _lines != null?rr.AsEnumerable(_lines).GetEnumerator() : rr.AsEnumerable(_textReader).GetEnumerator();

            return(ChoEnumeratorWrapper.BuildEnumerable <T>(() => e.MoveNext(), () => (T)ChoConvert.ChangeType <ChoRecordFieldAttribute>(e.Current, typeof(T))).GetEnumerator());
        }