AttributeUsageExample.Program.Main C# (CSharp) Method

Main() public static method

public static Main ( string args ) : void
args string
return void
        public static void Main(string[] args)
        {
            try
            {
                // Open the default app.config file which in this case is SimpleExample.exe.config
                // and it is located in the same folder as the SimpleExample.exe.
                settings = AppSettings.CreateForAssembly(Assembly.GetEntryAssembly(), FileOption.FileMustExist);

                // Write all the settings into our own object
                var mySettings = new MyApplicationSettings();
                settings.WriteInto(mySettings);

                mySettings.StringValue = new string(mySettings.StringValue.Reverse().ToArray());

                // Read everything back into settings and save
                settings.ReadFrom(mySettings);
                settings.Save();
            }
            catch (Exception exp)
            {
                Console.Error.WriteLine(exp.Message);
                throw;
            }
        }
Program