正则表达式不是有效的类型或命名空间C#
发布时间:2020-12-14 02:30:24 所属栏目:百科 来源:网络整理
导读:我正在尝试将此代码段添加到我的代码中: public string Highlight(string InputTxt){ string Search_Str = txtSearch.Text.ToString(); // Setup the regular expression and add the Or operator. Regex RegExp = new Regex(Search_Str.Replace(" ","|").T
我正在尝试将此代码段添加到我的代码中:
public string Highlight(string InputTxt) { string Search_Str = txtSearch.Text.ToString(); // Setup the regular expression and add the Or operator. Regex RegExp = new Regex(Search_Str.Replace(" ","|").Trim(),RegexOptions.IgnoreCase); // Highlight keywords by calling the //delegate each time a keyword is found. return RegExp.Replace(InputTxt,new MatchEvaluator(ReplaceKeyWords)); // Set the RegExp to null. RegExp = null; } 但是,由于某种原因,“Regex”没有显示 – 找不到类型或命名空间.我想我必须使用更新版本的C# – 任何人都可以用更新的方式来帮我解决这个问题吗?我使用的是System.Text.RegularExpressions.Regex – 也许他们完全摆脱了它? using System.Text.RegularExpressions; 尝试该命名空间. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- duilib中添加自定义控件之后怎么能够在xml文件中配置使用
- ruby-on-rails-3 – 将Sprockets的`depend_on`指令指向非资
- 汉诺塔VB实现
- Oracle因删除库数据文件导致服务无法启动的处理方法
- 父SWF与子SWF之间的传值
- ruby-on-rails – 哪个是indextank更好的宝石?
- Oracle Linux And Oracle Database 11g R2 Intsallation
- 数组 – 无法将任何数组类型传递给以[Any]作为参数的函数
- 如何使用xmltodict从xml文件中获取项目
- cocos2d-x create_project.py python3版本