public async Task <bool> HasLinkAsync(string text) { using (performanceHandleFactory.StartMeasuringPerformance()) return(await Task.Run( async() => { var words = GetWords(text); var suspiciousWords = ExtractSuspiciousWords(words); if ( await asyncFilter.HasMatchAsync( suspiciousWords, IsValidLinkAsync)) { return true; } var nonSuspiciousWords = ExtractNonSuspiciousWords(words); return await asyncFilter.HasMatchAsync( nonSuspiciousWords, IsValidLinkAsync); })); }
async Task <bool> HasLinkWithConditionsAsync(string text, Func <string, Task <bool> > validationFunction) { using (performanceHandleFactory.StartMeasuringPerformance()) { var words = GetWords(text); return(await asyncFilter.HasMatchAsync( words, validationFunction)); } }