You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inconsistent accessibility: return type 'type' is less accessible than method 'method'
14
14
15
-
The return type and each of the types referenced in the formal parameter list of a method must be at least as accessible as the method itself. For more information, see [Access Modifiers](../../programming-guide/classes-and-structs/access-modifiers.md).
15
+
The return type and each of the types referenced in the formal parameter list of a method must be at least as accessible as the method itself. This includes type arguments of generic types used in the return type or parameters. For more information, see [Access Modifiers](../../programming-guide/classes-and-structs/access-modifiers.md).
16
16
17
-
## Example
17
+
## Examples
18
18
19
19
The following sample generates CS0050 because no accessibility modifier is supplied for `MyClass`, and its accessibility therefore defaults to `private`:
20
20
@@ -36,3 +36,43 @@ public class MyClass2
36
36
publicstaticvoidMain() { }
37
37
}
38
38
```
39
+
40
+
CS0050 can also occur when a generic type's type argument is less accessible than the method:
0 commit comments