public static ValueOrError <CrontabField> TryParse(CrontabFieldKind kind, string expression, ExceptionHandler onError) { var field = new CrontabField(CrontabFieldImpl.FromKind(kind)); var error = field._impl.TryParse(expression, field.Accumulate, onError); return(error == null ? field : (ValueOrError <CrontabField>)error); }
public static T TryParse <T>(CrontabFieldKind kind, string expression, Func <CrontabField, T> valueSelector, Func <ExceptionProvider, T> errorSelector) { var field = new CrontabField(CrontabFieldImpl.FromKind(kind)); var error = field._impl.TryParse(expression, field.Accumulate, null, e => e); return(error == null?valueSelector(field) : errorSelector(error)); }