2023年1月10日星期二

C# TaskRun with parameter and return

====================
private bool IsSkipInput(string content)
{
    if (skipInput == null) return false;

    // skip if match the pattern
    if (skipInput.isTrue(content)) return true;
    return false;
}
====================
public async void matchText(string content, List<Match> matches)
{
    if (string.IsNullOrEmpty(pattern)) return;
    
    bool isSkipOK = await Task.Run<bool>(() => { return IsSkipInput(content); });
    if (isSkipOK)
    {
        return ;
    }
}

没有评论: