Please forgive me I'm a self educated c# coder, I never learned coding at a school. And sometimes i miss the terminology or logic behind common practices. I am wondered about the "using" keyword in C#.
using can be placed in the header of a program like:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
But I also see it sometimes "inline" like below. I say inline and that's probably a wrong term, but I don't know how this is called
using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(saveSettingsDialog.FileName))
{
//code to be placed to do something (in this case fill an xml)
}
Thinking about code design, I wonder when is it preferred to use the "inline" syntax. And does it provide some extra benefit ?