RCS1186: Use Regex instance instead of static method
Properties
Property | Value |
---|---|
Default Severity | Hidden |
Minimum language version | - |
Examples
Example #1
diagnostic.cs
private void Bar()
{
bool isMatch = Regex.IsMatch("abc", @"\w");
}
fix.cs
private readonly Regex _regex = new Regex(@"\w");
private void Bar()
{
bool isMatch = _regex.IsMatch("abc");
}