8
Reply

what is the significance of "using" keyword in c#?

Anil Kumar Murmu

Anil Kumar Murmu

May 26, 2014
2.7k
0

    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

    Abhijit Patil
    June 21, 2014
    2

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

    Khan Abrar Ahmed
    May 26, 2014
    1

    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

    Suresh Mogudala
    September 12, 2014
    0

    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();}}

    Suresh Mogudala
    September 12, 2014
    0

    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

    Pradeep Shet
    June 15, 2014
    0

    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

    Ravi Prakash
    June 05, 2014
    0

    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.

    Swaraj Patil
    May 27, 2014
    0

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

    Bhabani Prasad
    May 26, 2014
    0