/// <summary> /// Return the next element if it has the expected type. Throw an /// exception otherwise. /// </summary> private K3pElement GetNext(K3pElement.K3pType expected) { K3pElement el = Reader(); CheckType(expected, el.Type); return(el); }
/// <summary> /// Throw an exception if the expected type does not match the actual /// type. /// </summary> private void CheckType(K3pElement.K3pType expected, K3pElement.K3pType actual) { if (expected != actual) { throw new K3pException("expected K3P " + K3pElement.GetTypeName(expected) + ", received K3P " + K3pElement.GetTypeName(actual)); } }