private bool disposedValue = false; // 要检测冗余调用 protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (type == TagType.Compound) { writer.WriteTagEnd(); } } // TODO: 释放未托管的资源(未托管的对象)并在以下内容中替代终结器。 this.writer = null; disposedValue = true; } }
public HalfTagCloser(NBTWriter writer, TagType type) { this.writer = writer; this.type = type; }