Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 2150 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > ASP.NET Interview Questions > What is using statement versus using dir ...

What is using statement versus using directive?

Interview question and answer by: Tripati_tutu | Posted on: 10/28/2010 | Category: ASP.NET Interview questions | Views: 1033 | | Points: 40
Ads
Ads


Answer:

You can create an instance in a using statement to ensure that Dispose is called on the object when the using statement is closed or else we can say Using automatically calls the stream object’s Dispose method when the Using statement is closed. A using statement can be exited either when the end of the using statement is reached or if an exception is thrown and control leaves the statement block before the end of the statement.

The using directive has two uses:
• Create an alias for a namespace (a using alias).
• Permit the use of types in a namespace, such that, you do not have to qualify the use of a type in that namespace (a using directive).

Asked In: Many Interviews | Alert Moderator 
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from Tripati_tutu

Even more ... | Submit Interview Questions and win prizes!


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/18/2013 5:02:07 PM