| Start |
|---|
| Basic concept of IDisposable Any time you instantiate a class that Implements The For example without Now with One major advantage Consider the following. If an exception is thrown, you need to need to remember to call .Dispose but you might also have to check the state of the object to ensure you don't get a null reference error, etc. A using block means you don't have to remember to do this and you can declare your object inside the 1 Do I always have to call Dispose() on my DbContext objects? Nope (opens new window) |
| Declaring more objects in one Using Sometimes, you have to create two This code can be shortened into this one. The main advantage is that you gain one indentation level: |
Read Article
https://develop.horje.com/learn/1434/reference