public bool EnsureValid(int count) { // object not indexable. if (count == -1) { return false; } // check bounds. if (m_begin > count || m_end >= count) { return false; } // set begin. if (m_begin < 0) { m_begin = 0; } // set end. if (m_end < 0) { m_end = count; } return true; } #endregion