/// <summary> /// Advances to the next object property if any, and returns <see langword="true"/> if successful. /// </summary> /// <remarks> /// <para> /// It returns <see langword="false"/> if the <c>JReader</c> has reached the end of the object, /// or if the object was empty or null. /// </para> /// <para> /// If <c>Next</c> returns <see langword="true"/>, you can then use <see cref="Name"/> to check /// the name of the property, and use <see cref="JReader"/> methods such as <see cref="JReader.Bool"/> /// to read the element value. If you do not care about the value, simply calling <c>Next</c> again /// without calling a <c>JReader</c> method will discard the value. /// </para> /// </remarks> /// <returns><see langword="true"/> if there is a next object property</returns> public bool Next(ref JReader reader) { if (!_defined) { return(false); } _name = reader.ObjectNext(!_afterFirst); _afterFirst = true; if (!_name.Empty) { if (_requiredProperties != null) { for (int i = 0; i < _requiredProperties.Length; i++) { if (_name.Equals(_requiredProperties[i])) { _foundProperties[i] = true; break; } } } return(true); } if (_requiredProperties != null) { for (int i = 0; i < _requiredProperties.Length; i++) { if (!_foundProperties[i]) { throw new RequiredPropertyException(_requiredProperties[i], reader.LastPos); } } } return(false); }