Exemple #1
0
        /// <summary>
        /// Simple wrapper that constructs an instance of type T from the command line string.
        /// See ArgumentCollection.Construct() for documentation.
        /// </summary>
        /// <typeparam name="T">The Parsable type to be constructed</typeparam>
        /// <param name="commandString">The string from which to construct</param>
        /// <returns>The fully instantiated object</returns>
        public static T Construct <T>(string commandString)
        {
            CommandArguments command = new CommandArguments(commandString);

            return(command.Construct <T>());
        }
Exemple #2
0
        /// <summary>
        /// Constructs and instance of T, then runs it. This convenience method creates an instance of CommandArguments, then
        /// call ConstructAndRun on that result.
        /// </summary>
        /// <typeparam name="T">A //[Parsable] type that implements IExecutable.</typeparam>
        /// <param name="commandArgs">Command line arguments.</param>
        public static void ConstructAndRun <T>(string[] commandArgs) where T : IRunnable
        {
            CommandArguments command = new CommandArguments(commandArgs);

            command.ConstructAndRun <T>();
        }