编辑::此问题是What在处置时,管理和本土资源之间的区别是什么? (.NET)等等。请回答别人,如果你有什么要补充。
This question is a duplicate of What is the difference between managed and native resources when disposing? (.NET) and many others. Please answer the others if you have something to add.
按照框架设计指南的由克日什托夫·Cwalina和布拉德·艾布拉姆斯,包含一次性类型的实例应该实现IDisposable类型。
According to the Framework Design Guidelines by Krzysztof Cwalina and Brad Abrams, a type that contains instances of disposable types should implement IDisposable.
有经验的任何其他一般规则,当它要实现IDisposable最佳做法?
Is there any other general rule of thumb for when it is best practice to implement IDisposable?
实现IDisposable当你有一类什么包装非托管资源,或当你有这个类实现了IDisposable的字段。
Implement IDisposable when you have a class what wraps an unmanaged resource or when your class has a field that implements IDisposable.