This project is read-only.

Experimental By Example

This page contains experimental functions which are not included in Downloads but exist in the head revision of the source code

#1 The Default API allows you to assign a default value for an argument if the argument has not been provided

        public void DefaultShouldWork()
            var ethalon = TimeSpan.FromSeconds(10);

            var map = new ArgumentsMap().AddKnownArgument("timeout")

            var result = new ArgumentParser(map).Parse(null);

            Assert.AreEqual(ethalon, result.GetValue<TimeSpan>("timeout"));

#2 The IgnoreUnknownArguments API allows you to make a parser to ignore unmapped arguments

        public void IgnoreUnknownArgumentsWorks()
            var args = new List<string>

            var map = new ArgumentsMap().IgnoreUnkonwnArguments(true)

            var result = new ArgumentParser(map).ParseAsDynamicResult(args);


Last edited Apr 28, 2011 at 9:12 PM by ljuk, version 2


No comments yet.