Thursday, September 18, 2008

Two uses of using keyword in C#

There are two uses of using keyword in C#

i)Using as Directive in C# can be used for importing namespaces to your classes.

ii)Another most useful advantage is it can be used in codeblocks what is does is it calls the Dispose() method automatically to release the resources and also automatically implements the try catch blocks for you.Here it is called a using statement.So the advantage is that we dont have to explicitly write a try-catch block and our code looks tidy.


Post a Comment