Is there any benefit to implementing IDisposable on classes which do not have resources?

后端 未结 11 2101
挽巷
挽巷 2020-12-14 05:14

In C#, if a class, such as a manager class, does not have resources, is there any benefit to having it : IDisposable?

Simple example:

pu         


        
11条回答
  •  猫巷女王i
    2020-12-14 06:01

    There won't be a scrap of difference between the disposable and non-disposable version if you don't explicitly make use of the Dispose() method.

提交回复
热议问题