Framework Design Guidelines: Factored Types
Continuing in our weekly blog post series that highlights a few of the new additions to the Framework Design Guidelines 2 nd edition .. This content is found in the Factored Types section of Chapter 9: Common Design Patterns. Phil offers some great additions to the base pattern. PHIL HAACK Since Factored Types have an explicit lifetime, it probably makes good sense to implement the IDisposable interface so that developers can make use of the using statement. The code sample here could then be refactored to: using(SerialPort port = new SerialPort("COM1")) { port.Open(); GZipStream compressed; compressed = new GZipStream(port.BaseStream, CompressionMode.Compress);
Read More...
Read the complete post at http://blogs.msdn.com/brada/archive/2009/02/23/framework-design-guidelines-factored-types.aspx