コード例 #1
0
 public MaxValue(IArgument <T> target, T maxValue)
 {
     Target         = target;
     MaxVal         = maxValue;
     _lazyMakeValid = new misc.Lazy <IEnumerable <ISolution <IParserResult> > >(
         () => new ReadOnlyCollection <ISolution <IParserResult> >(
             new List <ISolution <IParserResult> > {
         new Solution <IParserResult>(
             new[] {
             new SetValue <T>(target, maxValue)
         }),
         new Solution <IParserResult>(
             new[] {
             new PromptValue <T>(target)
         })
     }));
     _lazyMakeInvalid = new misc.Lazy <IEnumerable <ISolution <IParserResult> > >(
         () => new ReadOnlyCollection <ISolution <IParserResult> >(
             new List <ISolution <IParserResult> > {
         new Solution <IParserResult>(
             new[] {
             new SetValue <T>(
                 target,
                 SetValue <T> .Add(maxValue, (T)Convert.ChangeType(1, typeof(T))))
         })
     }));
 }