Search code examples
c#.netusing

When should I use "using" blocks in C#?


Are there particular instances where I should (or shouldn't?) be using "using" blocks:

using(SomeType t = new SomeType()){
    ...
}

Solution

  • When the SomeType class implements IDisposable.