Nini Library API Reference - http://nini.sourceforge.net/

ArgvConfigSource.AddSwitch Method (String, String, String)

Adds a command line switch including a short switch.

public void AddSwitch(
   string configName,
   string longName,
   string shortName
);

Parameters

configName
The configuration (IConfig) name to add the value to if it is found.
longName
The long switch name (without the "-", "--", or "/").
shortName
The short switch name (without the "-", "--", or "/").

Remarks

Calling this will cause Nini to search the arguments for the matching switch.

Example

public static int Main (string[] args)
{
   ArgvConfigSource source = new ArgvConfigSource (args);

   source.AddSwitch ("Logging", "file-name", "f");
   source.AddSwitch ("Logging", "columns", "c");
   source.AddSwitch ("Logging", "max-file-size", "m");

   if (args.Length > 0)
   {
      string fileName = config.Configs["Logging"].Get ("file-name");
      int columns = config.Configs["Logging"].GetInt ("columns");
      long fileSize = config.Configs["Logging"].GetLong ("max-file-size");
   }
}
                

See Also

ArgvConfigSource Class | Nini.Config Namespace | ArgvConfigSource.AddSwitch Overload List