close or dispose

前端 未结 6 1468
春和景丽
春和景丽 2020-12-03 09:44

StreamReader class has both close and dispose method. I want to know which method to call to clean up all resources.

If making use of using block, I think it will c

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 10:33

    If you want further information about using, take a look here

    Using

    Quote from site:

    The using statement allows the programmer to specify when objects that use resources should release them. The object provided to the using statement must implement the IDisposable interface. This interface provides the Dispose method, which should release the object's resources.

提交回复
热议问题