Compiler Error CS1102
The parameter modifier 'out' cannot be used with 'this'.
When the this keyword modifies the first parameter of a static method, it signals to the compiler that the method is an extension method. No other modifiers are needed or allowed on the first parameter of an extension method.
To correct this error
- Remove the unauthorized modifiers from the first parameter.
Example
The following example generates CS1102:
// cs1102.cs
// Compile with: /target:library.
public static class Extensions
{
// No type parameters.
public static void Test(this out int i) {} // CS1102
//Single type parameter
public static void Test<T>(this out T t) {}// CS1102
//Multiple type parameters
public static void Test<T,U,V>(this out U u) {}// CS1102
}