Disposable Using Pattern

前端 未结 5 1243
天涯浪人
天涯浪人 2021-01-04 04:56
  using (FileStream fileStream = new FileStream(path))
  {
    // do something
  }

Now I know the using pattern is an implementation of IDisposable

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-04 05:22

    I don't think the using calls Close(), it would have no way of knowing that it should call that particular function. So it must be calling dispose, and that in turn is calling close.

提交回复
热议问题