Am I implementing IDisposable correctly?
问题 This class uses a StreamWriter and therefore implements IDisposable . public class Foo : IDisposable { private StreamWriter _Writer; public Foo (String path) { // here happens something along the lines of: FileStream fileWrite = File.Open (path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite); _Writer = new StreamWriter (fileWrite, new ASCIIEncoding ()); } public void Dispose () { Dispose (true); GC.SuppressFinalize (this); } ~Foo() { Dispose (false); } protected virtual void