Legacy protected dispose patternSee original GitHub issue
Does anyone have any information about why the protected dispose pattern is marked as “LEGACY” in this analyzer? It looks to me like using
protected virtual Dispose(bool disposing) aligns more closely with the suggested Dispose pattern that can be found on MSDN, so I’m not sure why it’s labeled as “legacy”.
- Created 3 years ago
- Comments:20 (5 by maintainers)
Top GitHub Comments
I think I prefer LEGACY as it indicates that it is not the preferred pattern by this opinionated analyzer.
My thinking is that full could be interpreted as this is what you want if you want to do it properly.
@Bosch-Eli-Black the analyzer encourages the use of a newer and much simpler pattern over the pattern originally developed, leveraging best practices information learned in the meantime. I would recommend changing ‘legacy’ to ‘full’, but without question would continue to discourage its use. The only cases where the ‘full’ pattern makes sense are:
- A public library which already has an established public API that consistently uses the full pattern (this would include developing new code in the BCL)
- Implementing a type which derives from a base class that use the full pattern, e.g.