/// ドキュメントの管理を行う
/// </summary>
/// <remarks>この型のすべてのメソッド・プロパティはスレッドセーフです</remarks>
- public sealed class Document : IEnumerable<char>, IRandomEnumrator<char>
+ public sealed class Document : IEnumerable<char>, IRandomEnumrator<char>, IDisposable
{
Regex regex;
Match match;
if(this.FireUpdateEvent)
this.Update(this, e);
}
+
+ #region IDisposable Support
+ private bool disposedValue = false; // 重複する呼び出しを検出するには
+
+ void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ this.buffer.Clear();
+ this.LayoutLines.Clear();
+ this.buffer = null;
+ this._LayoutLines = null;
+ }
+
+ disposedValue = true;
+ }
+ }
+
+ // このコードは、破棄可能なパターンを正しく実装できるように追加されました。
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
/// <summary>