Compiler Error CS1067
Partial declarations of 'type' must have the same type parameter names and variance modifiers in the same order.
Both defining and implementing declaration of a generic partial interface must have their signatures matching including the type parameters and variance modifers in the same order between defining and implementing declaration.
Example
The following samples generate CS1067:
// CS1067: type parameter 'T' has an extra 'out' modifier
public partial interface IExample1<out T>;
public partial interface IExample1<T>
{ }
// CS1067: type parameter 'T' differs in variance modifier
public partial interface IExample2<in T>;
public partial interface IExample2<out T>
{ }
// CS1067: type parameters 'T' and 'S' differs in their order
public partial interface IExample3<in S, out T>;
public partial interface IExample3<out T, in S>
{ }
To correct this error
Keep the same signatures for both defining and implementing declaration of a generic partial interface:
public partial interface IExample1<T>;
public partial interface IExample1<T>
{ }
public partial interface IExample2<out T>;
public partial interface IExample2<out T>
{ }
public partial interface IExample3<out T, in S>;
public partial interface IExample3<out T, in S>
{ }
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