예제 #1
0
        public override ValueTask <TypeParserResult <T> > ParseAsync(Parameter parameter, string value, CommandContext context)
        {
            var nouns = (ImmutableArray <string>)parameter.Service.NullableNouns;

            return(nouns.Any(x => value.Equals(x, parameter.Service.StringComparison))
                ? new ValueTask <TypeParserResult <T> >(new TypeParserResult <T>(false))
                : _typeParser.ParseAsync(parameter, value, context));
        }
예제 #2
0
        ParseAsync(Parameter parameter, string value, CommandContext context, IServiceProvider provider)
        => parameter.Service.NullableNouns.Any(x => value.Equals(x, parameter.Service.StringComparison))
#if NETCOREAPP
                ? new ValueTask <TypeParserResult <T> >(new TypeParserResult <T>(false))
#else
                ? Task.FromResult(new TypeParserResult <T>(false))
#endif
                : _typeParser.ParseAsync(parameter, value, context, provider);
예제 #3
0
 public override ValueTask <TypeParserResult <T> > ParseAsync(Parameter parameter, string value, CommandContext context)
 {
     return(parameter.Service.NullableNouns.Any(noun => value.Equals(noun, parameter.Service.StringComparison))
         ? new(new TypeParserResult <T>(false))
         : _typeParser.ParseAsync(parameter, value, context));
 }
예제 #4
0
 public override Task <TypeParserResult <T> > ParseAsync(Parameter parameter, string value, ICommandContext context, IServiceProvider provider)
 => parameter.Service.NullableNouns.Any(x => value.Equals(x, parameter.Service.StringComparison))
         ? Task.FromResult(new TypeParserResult <T>(false))
         : _typeParser.ParseAsync(parameter, value, context, provider);
예제 #5
0
 public override Task <TypeParserResult <T> > ParseAsync(string input, ICommandContext context, IServiceProvider provider)
 => _service.NullableNouns.Any(x => input.Equals(x, _service.StringComparison))
         ? Task.FromResult(new TypeParserResult <T>(false))
         : _typeParser.ParseAsync(input, context, provider);