加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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();
        }
    }
}

它编译并运行没有错误.
我在Console.ReadKey()设置了一个断点,因为我想检查变量匹配.
但是我收到了我在这个帖子标题中输入的奇怪错误信息.
网络上并不清楚它的含义.

解决方法

如果您在Optimize Code上进行了切换,那么变量匹配就会被优化掉.如果您当前的构建配置文件是RELEASE,通常就是这种情况.将其更改为DEBUG,然后不使用代码优化,您可以访问所需的变量.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读