Top "Using" questions

"using" is a keyword in some programming languages (C++, C#, VB.

Using various types in a 'using' statement (C#)

Since the C# using statement is just a syntactic sugar for try/finally{dispose}, why does it accept multiple objects …

c# types using
return the variable used for using inside the using C#

I am returning the variable I am creating in a using statement inside the using statement (sounds funny): public DataTable …

c# dispose idisposable using using-statement
Why can't I put a "using" declaration inside a class declaration?

I understand the troubles you can get into when you put a using declaration inside a header file, so I …

c++ namespaces header compiler-errors using
What requires me to declare "using namespace std;"?

This question may be a duplicate, but I can't find a good answer. Short and simple, what requires me to …

c++ namespaces include using using-directives
Getting rid of nested using(...) statements

Sometimes I need to use several disposable objects within a function. Most common case is having StreamReader and StreamWriter but …

c# idisposable using
Does a C# using statement perform try/finally?

Suppose that I have the following code: private void UpdateDB(QuoteDataSet dataSet, Strint tableName) { using(SQLiteConnection conn = new SQLiteConnection(_connectionString)) { …

c# exception using using-statement
Does a MemoryStream get disposed of automatically when returning it as an ActionResult?

public ActionResult CustomChart(int reportID) { Chart chart = new Chart(); // Save the chart to a MemoryStream var imgStream = new MemoryStream(); chart.…

c# jquery asp.net-mvc using memorystream
"Using" vs [DllImport]?

I was wondering what is the very top most declared references and why we still need to use DllImport? I'm …

c# pinvoke dllimport using
Can "using" with more than one resource cause a resource leak?

C# lets me do the following (example from MSDN): using (Font font3 = new Font("Arial", 10.0f), font4 = new Font("Arial", 10.0…

c# using using-statement
Using Statement with Generics: using ISet<> = System.Collections.Generic.ISet<>

Since I am using two different generic collection namespaces (System.Collections.Generic and Iesi.Collections.Generic), I have conflicts. In …

c# generics syntax alias using