private object GetNext(out long objID)
{
bool isNew;
//The Queue is empty here. We'll throw if we try to dequeue the empty queue.
if (_objectQueue.Count == 0)
{
objID = 0;
return null;
}
object obj = _objectQueue.Dequeue();
// A WriteObjectInfo is queued if this object was a member of another object
object realObj = obj is WriteObjectInfo ? ((WriteObjectInfo)obj)._obj : obj;
objID = _idGenerator.HasId(realObj, out isNew);
if (isNew)
{
throw new SerializationException(SR.Format(SR.Serialization_ObjNoID, realObj));
}
return obj;
}