Search code examples
c#using-statement

this keyword inside a using block in C#


What does this refer to inside of a using block in C#?


Solution

  • this inside of a using block refers to the same thing as this outside of a using block: the current instance of the class.

    A using block should be used with all classes that implement the IDisposable interface. It's an implementation detail of the class if it wraps managed and/or unmanaged resources.