generic_cloud_storage_client.MySettings.Save C# (CSharp) Method

Save() public method

public Save ( ) : void
return void
        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();

                }
             }
        }

Usage Example

 public OpenStack(String user,String pass)
 {
     this._Username=user;
     this._Password = pass;
     if (!isSaved)
     {
     _Settings = new MySettings();
     _Settings.Username = user;
     _Settings.Password = new Encrypt().Encrypting(pass);
     _Settings.Save();
     isSaved = true;
     }
 }
MySettings