protected static bool IsTerminated(BoundedStream stream, ValueNode terminationChild, object terminationValue, EventShuttle eventShuttle) { if (terminationChild != null) { using var streamResetter = new StreamResetter(stream); terminationChild.Deserialize(stream, eventShuttle); if (terminationChild.Value.Equals(terminationValue)) { streamResetter.CancelReset(); return(true); } } return(false); }