public void Save()
{
using(Stream _Stream= File.Create(SettingsFile))//FIle returns stream
{
try
{
XmlSerializer _Object = new XmlSerializer(this.GetType());//writes bytes in the file
_Object.Serialize(_Stream, this);
}
catch (InvalidOperationException)
{
_Stream.Close();
}
}
}