Gaurav Mishra
What are the 2 use of using statement in C#?
By Gaurav Mishra in ASP.NET on Oct 29 2013
  • Dominic Roberts
    Nov, 2013 5

    There are more than 2 uses. 1. To import the namespace e.g. using System; 2. To create an alias e.g. using connection= System.Data.Common.DbConnection; 3. To wrap the disposing of an IDisposable in a Try/ Finally block to ensure Dispose is called on the IDisposable IDisposable d = new DisposableObject(); try { .... } finally { d.Dispose(); }

    • 0
  • Gaurav Mishra
    Oct, 2013 29

    1: To import the namespace

    2: To close the connection property

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS