Top "Using" questions

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

What is the C# Using block and why should I use it?

What is the purpose of the Using block in C#? How is it different from a local variable?

c# .net syntax using using-statement
What are the uses of "using" in C#?

User kokos answered the wonderful Hidden Features of C# question by mentioning the using keyword. Can you elaborate on that? …

c# using using-statement
What is the use of "using namespace std"?

What is the use of using namespace std? I'd like to see explanation in Layman terms.

c++ namespaces std using
MySQL ON vs USING?

In a MySQL JOIN, what is the difference between ON and USING()? As far as I can tell, USING() is …

mysql join using
in a "using" block is a SqlConnection closed on return or exception?

First question: Say I have using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); string storedProc = "GetData"; SqlCommand command = new SqlCommand(…

c# using sqlconnection
Do HttpClient and HttpClientHandler have to be disposed between requests?

System.Net.Http.HttpClient and System.Net.Http.HttpClientHandler in .NET Framework 4.5 implement IDisposable (via System.Net.Http.HttpMessageInvoker). The …

c# .net-4.5 idisposable using dotnet-httpclient
What is the best workaround for the WCF client `using` block issue?

I like instantiating my WCF service clients within a using block as it's pretty much the standard way to use …

c# vb.net wcf using wcf-client
Should I Dispose() DataSet and DataTable?

DataSet and DataTable both implement IDisposable, so, by conventional best practices, I should call their Dispose() methods. However, from what …

datatable dataset dispose idisposable using
Nested using statements in C#

I am working on a project. I have to compare the contents of two files and see if they match …

c# .net file using
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()){ ... }

c# .net using