I see it used and I read about it here and there and it has something to do with memory management. Question is, how do you know when you should use it? How do you tell the difference between variables or instances that will cause a problem if you don't use it?
Exact duplicate: What is the C# Using block and why should I use it?
最佳答案
每当实例化实现IDisposable的类的对象时。
关于c# - 什么时候应该在C#中使用using(…){…}? ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/678781/