我正在定义一个新类。有两个问题:
Match m = Regex.Match(text, pattern, RegexOptions.IgnoreCase, TimeSpan.FromSeconds(1));
给出了这个错误:“没有重载方法'Match'接受4个参数”。但是MSDN用4个参数定义了它。
catch (RegexMatchTimeoutException)
出现以下错误:"The type or namespace name 'RegexMatchTimeoutException' could not be found (are you missing a using directive or an assembly reference?)"
我的使用的指令:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
我正在运行带有.NET4.5的VS2008Express。
Match
方法仅在.NET 4.5中引入。 - Ulugbek Umirov