rspec/rules/S2259/csharp/exception-code-extension-method.adoc
2023-07-03 17:26:15 +02:00

23 lines
484 B
Plaintext

[source,csharp]
----
using System;
using System.Text.RegularExpressions;
public static class Program
{
public static string RemoveVowels(this string value)
{
if (value == null)
{
return null;
}
return Regex.Replace(value, "[aeoui]*","", RegexOptions.IgnoreCase);
}
public static void Main()
{
Console.WriteLine(((string?)null).RemoveVowels()); // Compliant: 'RemoveVowels' is an extension method
}
}
----