Anil Kumar Murmu
what is the significance of "using" keyword in c#?
By Anil Kumar Murmu in .NET on May 26 2014
  • Abhijit  Patil
    Jun, 2014 21

    using is the system keyword which is used for importing the namespace..for example using system.here system is the namespace.for importing any namespace you must need to use the "Using" Keyword

    • 2
  • Khan Abrar Ahmed
    May, 2014 26

    http://en.wikibooks.org/wiki/C_Sharp_Programming/Keywords/using http://www.codeproject.com/Articles/6564/Understanding-the-using-statement-in-C

    • 1
  • Suresh Mogudala
    Sep, 2014 12

    Using Imports the All the Details of within the Namespaces you can write you were own classes and use it multiple places in your application For Example using system.Data ; means It will Imports the Dataset, DataTable classes with respective Methods,Events and etc Properties

    • 0
  • Suresh Mogudala
    Sep, 2014 12

    Take one Class Library and Build itnamespace Example {public class sample{public int math(int i,int j){return (i + j);}} }Now you want to Use math(or any thing from the Example NameSpace) method in your forms/ApplicationYou should Add the Reference(from Bin folder of Example classlibrary) and Mention Namespace Name so that It can be Included li//Importing the Example Namespace Classes or any thing from the Namespace using Example;//Region of code can be accessPublic class mathOperations{static void Main(string[] args){//Creating Object for Sample Class sample sa = new sample();//object with Parametarized Methods callingConsole.WriteLine("Adding Two Numbers: " + sa.math(10, 20));Console.ReadLine();}}

    • 0
  • Pradeep Shet
    Jun, 2014 15

    using keyword is used to define the scope of object being created. Once code is get executed outside the using block the resource get released from memory

    • 0
  • Ravi  Prakash
    Jun, 2014 5

    Using keyword will be used when we want to release unmanged resources that have associated with object and occupy unnecessary memory . It will be used like - using(SqlConnection sqlconnection= new SqlConnection(connectionString) ) {}and class Object

    • 0
  • Swaraj Patil
    May, 2014 27

    Using keyword will be used when we want to release unmanged resources associated with object. It will be used like - using(SqlConnection sqlconnection= new SqlConnection(connectionString) ) {}Here connection object will release connection with database after using block. Actualy compiler convert Using block into try/finally block where unmanged resouce will be released in finally block. Even if exception occured in using block, unmanged resource will be released in finally block.It is actualy callling dispose method of object after completion of using block. We can create multiple objects in using block.

    • 0
  • Bhabani Prasad
    May, 2014 26

    http://msdn.microsoft.com/en/library/yh598w02.aspx http://www.codeproject.com/Articles/6564/Understanding-the-using-statement-in-C

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS