コード例 #1
0
ファイル: ParsedArgFactory.cs プロジェクト: microsoft/Sloos
        public static Dictionary <string, ParsedArg> Create <T>()
            where T : new()
        {
            var factory = new ParsedArgFactory(typeof(T));

            return(factory.Create());
        }
コード例 #2
0
        public ArgsParser(string[] args)
        {
            this.args = args;

            Type type = typeof(T);

            this.opts = (T)Activator.CreateInstance(type);

            this.factory    = new ParsedArgFactory(type);
            this.parsedArgs = this.factory.Create();

            this.propertySetters = this.parsedArgs
                                   .ToDictionary(x => x.Key, x => CoercionHelpers.CreatePropertySetter <T>(x.Value.PropertyInfo));

            this.collectedArgs = new Dictionary <string, string>();
            this.SetDefaultValues();
        }