In C#, we use “using” keyword for two different purpose.
- “Using” keyword is used to include a namespace in the program. A program generally has multiple using statements.
- The using statement is used to obtain a resource, execute a statement, and then dispose of that resource.
Example:
using (SqlConnection dbConn = new SqlConnection(conn)){
// Your code
} // automatically does the .Dispose call as if it was in a finally block
[amazon_link asins=’9351190900,007070368X,8120352068,9386873583,8120349172,1787287041,9351343189,B016Z18MLG,1788478924|1840787198,1484230175,0985580135,1491987650,B016Z18MLG,1119458684,1119428114,1491988533,1119449278′ template=’ProductGrid’ store=’desibanjara22-21|desibanjaraco-21′ marketplace=’IN|UK’ link_id=’66554407-915d-11e8-9dd7-b3406be566d4′]