What Are the Three Uses of The Using Statement?  - C# Gotcha Interview Questions
Channel: Ryan McBeth
Date: 2021-02-01

This is what I call a "Seymore" question.  Seymore is that programmer who has been with the company for 8-12 years.  He probably wrote the software that you are being hired to extend or maintain.  His main objective is to prevent you from being hired because he doesn't want you to ask him questions all day.

You've probably the Using statement in C# to define the scope of an object or implement IDisposible.  You've also probably used it to add a namespace to a class.  

But did you know it can also create aliases and reference methods in static classes?

I like to remember the three uses of the Using statement with the mnemonic:

Dispose A Named SISter
This stands for:
Dispose and Object
Add a Namespace
Static Import Single