3
Reply

What is the use of ‘using’ declaration.

shubha

shubha

18y
9.8k
0
Reply

    using keyword in .net has the following usage: 1. it is used when you want to include a namespace in your current class and use the classes and properties of that namespace without the need to give fully qualified names.for example: using System; 2. it is used when you want to mark an object to be disposed as soon as it exits the current execution block allowing the garbage collector to collect it.for example:using (A obj = new A()) {//some operation goes here}This requires the class to implement IDisposable interface.

    A using declaration provides access to a specific namespace member. This is accomplished by applying the using keyword to a namespace name with its corresponding namespace member.

    A using declaration makes it possible to use a name from a namespace without the scope operator..