Compiler Error CS1105
Extension methods must be static.
Extension methods must be declared as static methods in a non-generic static class.
The following example generates CS1105 because Test
is not static:
C#
// cs1105.cs
// Compile with: /target:library
public class Extensions
{
// Single type parameter.
public void Test<T>(this System.String s) {} //CS1105
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: