C# Error
CS0703 – Inconsistent accessibility: constraint type ‘{1}’ is less accessible than ‘{0}’
Reason for the Error & Solution
Inconsistent accessibility: constraint type ‘identifier’ is less accessible than ‘identifier’
A constraint may not force the generic parameter to be less accessible than the generic class itself. In the following example, while the generic class C<T> is declared public, the constraint attempts to force T to implement an internal interface. Even if this were allowed, only clients with internal access would be able to create the parameter for the class, so in effect, the class could be used only by clients with internal access.
To get rid of this error, make sure the access level of the generic class is not less restrictive than any classes or interfaces that appear in the bounds.
The following sample generates CS0703:
// CS0703.cs
internal interface I {}
public class C<T> where T : I // CS0703 – I is internal; C<T> is public
{
}