public T Get <T>(int recno) where T : class, new() // new from 1.3 version { DbfRow row = this.GetRow(recno); T t = (T)Activator.CreateInstance(typeof(T), row); return(t); }
public void Dispose() { if (!disposed) { disposed = true; this.stream.Dispose(); _row = null; } }
// public static T Get <T>(DbfRow row) where T : class, new() // new from 1.3 version { if (row == null) { return(null); } T t = (T)Activator.CreateInstance(typeof(T), row); return(t); }
// http://stackoverflow.com/questions/1852837/is-there-a-generic-constructor-with-parameter-constraint-in-c // http://stackoverflow.com/questions/700966/generic-type-in-constructor public T Read <T>() where T : class, new() // new from 1.3 version { do { row_ = dbfTable.GetRow(nextRecNo, false); // Don't throw an exception, returns null if record not found nextRecNo++; } while (skipDeleted && (row_ != null) && row_.deleted); return(DbfTable.Get <T>(row_)); }
public bool Read() { do { row_ = dbfTable.GetRow(nextRecNo, false); // Don't throw an exception, returns null if record not found nextRecNo++; } while (skipDeleted && (row_ != null) && row_.deleted); return(row_ != null); }
public void SetSkipDeleted(bool newValue) { if (_row != null) { if (_row.deleted && newValue) { _row = null; // there isn't selected row already } } _skipDeleted = newValue; }
private DbfRow GetRow(int dbfRecNo) { if (dbfRecNo < 1) { // '< 1' because recno rule as dbase/index rule _row = null; // don't found } else { _row = _dbfTable.GetRow(dbfRecNo - 1, false); } return(_row); }
public IEnumerator <T> GetEnumerator() { for (int i = firstRecNo; (i <= lastRecNo); i++) { DbfRow row = table.GetRow(i); if (this.skipDeleted && row.deleted) { continue; } yield return(row.Get <T>()); } }
public IEnumerator <T> GetEnumerator <T>(bool skipDeleted) where T : class, new() { for (int i = 0; i < this.recCount; i++) { DbfRow row = this.GetRow(i); if (skipDeleted && row.deleted) { continue; } yield return(DbfTable.Get <T>(row)); } }
private bool MarchingOne(bool forward) { if (eof) { return(false); } // int direction = forward ? 1 : -1; do { _row = _dbfTable.GetRow(_row.recNo + direction, false); // Don't throw an exception, returns null if record not found } while (skipDeleted && (_row != null) && _row.deleted); return(_row != null); }