c# – 当前上下文中不存在名称“匹配”
发布时间:2020-12-15 23:24:34 所属栏目:百科 来源:网络整理
导读:我有这个代码: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Text.RegularExpressions;namespace RegexTest{ class Program { static void Main(string[] args) { string str = "The quick brown fox.
我有这个代码:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace RegexTest { class Program { static void Main(string[] args) { string str = "The quick brown fox."; string pat = "fox"; Regex rgx = new Regex(pat,RegexOptions.IgnoreCase); Match matches = rgx.Match(str); Console.ReadKey(); } } } 它编译并运行没有错误. 解决方法
如果您在Optimize Code上进行了切换,那么变量匹配就会被优化掉.如果您当前的构建配置文件是RELEASE,通常就是这种情况.将其更改为DEBUG,然后不使用代码优化,您可以访问所需的变量.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |