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
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for