This article on .NET resource management has been making its way around the blogsphere. Whether you're new to basic concepts like the Dispose pattern, or whether you're a .NET resource management guru, I highly recommend that you check out this article . Contributions to this article come from industry experts and .NET team members. Here's some of my thoughts:
- There's a lot more to resource management than the "IDisposable pattern"
- A new Whidbey feature, SafeHandles, is very cool for those of us who work with unmanaged resources (especially of the tempermental kind!)
- Finalizer != Destructor. When learning C# back in the 1.0.2914 days, this was a huge point of confusion for me. This article correctly points out that Dispose is closer to a Destructor in the sense that you can clean up resources in a deterministic fashion, whereas the Finalizer is nondeterministic and can be used as a “safety net“ for resource cleanup.
I have added two new Enterprise Library rules to my FxCop rules library. Version 1.1 also includes the Xml RuleDefinitions file with a nice XSLT to transform the definitions to HTML. The two new rules for 1.1 are:
- Use byte[] instead of String for Cryptographic functions
- Tracer instances must be disposed in reverse order
For more information see the
complete rule definitions.
Click here to download 1.1.
Please send me your feedback. Here's what I'm looking for:
- Bugs (i.e. false positive/negative rule validation)
- New rule ideas
- Improvements to existing rules or the distribution
Enjoy!