c# - 为什么我的 C# 代码中出现 "The name Regex does not exist in the current context"?

标签 c# regex

为什么我会收到此错误:

The name Regex does not exist in the current context.

来 self 的代码?

if (Regex.IsMatch(string1, @"^[a-zA-Z]+$"))

最佳答案

确保引用了 System.Text.RegularExpressions 命名空间。

关于c# - 为什么我的 C# 代码中出现 "The name Regex does not exist in the current context"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19171357/

相关文章:

regex - JavaScript 正则表达式

c# - 为什么在字典声明中使用接口(interface)?

javascript - 如何在 gridview 图像按钮内使用模态弹出扩展器?

c# - 具有共享业务对象的 WCF 每次调用服务

c# - 以编程方式中断事件的屏幕保护程序?

c# - 替换文本中的非字母数字字符

javascript - 正则表达式查找大括号中的内容

regex - Express 4 中的正则表达式用于捕获文件扩展名 .gz 的静态资源的所有请求

javascript - 如何使用 Javascript 正则表达式按设定顺序匹配子字符串

regex - 使用正则表达式匹配 "foreground"或 "foregroun"或 "foregrou"... 或 "f"最简单的方法是什么?