public bool HasMoreTokens() { //keeping the current pos long pos = currentPos; try { NextToken(); } catch (ArgumentOutOfRangeException) { return false; } finally { currentPos = pos; } return true; } }