Ryan McBeth
Ryan McBeth
@RyanMcBethProgramming·1.1M subscribers·2K videos

What Are the Three Uses of The Using Statement? - C# Gotcha Interview Questions

Posted

February 1, 2021

Views

10,881

Likes

517

Comments

25

Engagement

4.98%

Search the Record

Indexed

Every word spoken in this episode is indexed. Type any phrase to jump straight to the moment it was said.

Type any word or phrase that may have been spoken. Click a result to seek the player to that exact moment.

Try a name, a topic, or a quoted line

YouTube Description

as posted by the channel

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

Guests & Subjects Covered

C# Gotcha Interview QuestionsIDisposible You'veObject AddNamespace Static Import Single

Sentinel Indexing in Progress

Metadata and chapters are available. Claim extraction for this episode is pending.

All video content is delivered via YouTube embedded players in accordance with the YouTube Terms of Service. Sentinel provides research tools that promote discovery and accountability across political media.