Share via


Compiler Error CS1105

Extension methods must be static.

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

Example

The following example generates CS1105 because Test is not static:

// cs1105.cs
// Compile with: /target:library
public class Extensions
{
   
    // Single type parameter.
        public void Test<T>(this System.String s) {} //CS1105
    
}

See Also

Reference

Extension Methods (C# Programming Guide)

static (C# Reference)