I would like to extend the string object and have those extensions part of a nested class, however directly doing it this way :
public static class StringExtensions
{
    public static class Patterns
    {
        public static string NumbersOnly(this string s)
        {
            return new String(s.Where(Char.IsDigit).ToArray());
        }
    }
}
... gives the error as stated for the title of this post.
How can I write this differently so that when I call it, it can be called like this :
string s = "abcd1234";
s = s.Patterns.NumbersOnly();
I know I can move NumbersOnly as a direct child of StringExtensions to make the error go away, however my intention is to organize the methods into categories which will have a lot of methods.  In this example, NumbersOnly is just one of about 40 pattern matches I intend to have there and I do not wish to clutter of the root of the object with methods like: PatternNumbersOnly or NumbersOnly etc.
Note: This question is different than questions like this one as I am not asking why this problem exists, I am looking for a workaround so that I can have the functionality or similar functionality which the reason of this error is denying me from.
 
     
    