Is there a list of common object that implement IDisposable for the using statement?

前端 未结 9 2405
挽巷
挽巷 2020-12-17 15:10

I was wondering if there was some sort of cheat sheet for which objects go well with the using statement... SQLConnection, MemoryStream, etc.

9条回答
  •  余生分开走
    2020-12-17 15:59

    If you are using Visual Studio you can press F12 on a type declaration it will take you to a meta-data screen or the class definition (if you have the source code). If you keybindings are different right-click and "go to definition". From there you can see what a class implements. I suggest doing this for all classes the first time you encounter them to get a "feel" for what the class can do.

提交回复
热议问题