Compiler Error CS1106

Extension methods must be defined in a non generic static class.

Extension methods must be defined as static methods in a non-generic static class.

Example

The following example generates CS1106:

// CS1106.cs
public class NonStaticClass // CS1106
{
    public static void ExtensionMethod1(this int num) {}
}

public static class StaticGenericClass<T> // CS1106
{
    public static void ExtensionMethod2(this int num) {}
}

public static class StaticClass // OK
{
    public static void ExtensionMethod3(this int num) {}
}

See also