top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the importance of Using Statement and Using Keyword in C#?

0 votes
362 views
What is the importance of Using Statement and Using Keyword in C#?
posted May 12, 2017 by Rohini Agarwal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In C# , Usinf can be used in two ways:

1. As a directive where it's behavior will be as inclusion of namespace e.g

using System;

using System.IO;
  1. As a statement which can be used only with types that implements IDisposable interface e.g.

    ``using( SQLDataRedaer dr=cmd.ExecuteReader())
    {
    while(dr.Read());
    }

answer May 15, 2017 by Shweta Singh
...