示例#1
0
        public T ParseAndValidate <T>(string question, TryParse <T> convert, string error, Func <T, TryResult <T> > isValid)
        {
            if (convert is null)
            {
                throw new ArgumentNullException(nameof(convert));
            }

            if (isValid is null)
            {
                throw new ArgumentNullException(nameof(isValid));
            }

            var tryResult = convert.ToTryResult(error);

            return(Get <T>(question, (string v) => tryResult(v).ThenTry(isValid)));
        }