Results 1 to 8 of 8

Thread: "using" Keyword

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Answers
    1

    "using" Keyword

    what are the uses of "using" keyword?


  2. #2
    Junior Member
    Join Date
    Jan 2009
    Answers
    1

    Re: "using" Keyword

    Quote Originally Posted by simo80 View Post
    what are the uses of "using" keyword?
    It is used to acces method and function of system define dll.
    it inherti the dll.


  3. #3
    Junior Member
    Join Date
    Feb 2007
    Answers
    3

    Re: "using" Keyword

    There are multiple uses. It can also be used to define the scope of a specific object to make sure that the object is picked up by the GC as soon as the using area is exited.


  4. #4
    Contributing Member
    Join Date
    Jun 2007
    Answers
    65

    Re: "using" Keyword

    Quote Originally Posted by simo80 View Post
    what are the uses of "using" keyword?
    Hi,

    Basically there are two uses of using keyword.

    1. Include the namespace in current code file which is done at top of the code like
    using System.Data;
    using System.Data.Sql;

    2. Another use of using keyword is to dispose off objects automatically when runtime executes code outside the using block like
    using(SqlConnection objConn = new SqlConnection)
    {
    ............ your code
    }

    Once the runtime executes the code outside the using block SqlConnection will get closed and disposed off automatically. No need to write extra code.


    Hope this help you.


    ---V V---
    Vikas Vaidya
    Please mark this post as Thanks if you find the answer useful


  5. #5
    Junior Member
    Join Date
    Jan 2009
    Answers
    5

    Re: "using" Keyword

    Hi,

    The main use of using keyword is as follows,

    For e.g Suppose your program is having a namespace student,
    and you want this namespace add in another program, so to adding this namespace to the particular program we used using keyword.


    For e.g:- using student;

    now you can use the classes of student in your other program where you are giving the above statement.....


  6. #6
    Junior Member
    Join Date
    Apr 2009
    Answers
    5

    Re: "using" Keyword

    The Using Keyword used to load class file.


  7. #7
    Junior Member
    Join Date
    Jan 2008
    Answers
    3

    Re: "using" Keyword

    Hi,

    Use of Using Keyword

    1) To tell the compiler to acess the classes and methods in a particular namespace in currently working code .

    2) Used to create using statements, which define when an object will be disposed.


  8. #8
    Junior Member
    Join Date
    Apr 2009
    Answers
    1

    Re: "using" Keyword

    1) 'Using' Key word work same as 'Import' in JAVA or VB.net with namespace to import all the methods and classes.
    2) 'Using' key word is also used to limit the scope of the object within the method.


  9.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact