Faraz Shah Khan

MCP, MCAD.Net, MCSD.Net, MCTS-Win, MCTS-Web, MCPD-Web

Error: Inconsistent accessibility: return type

In one of my projects I found this error Inconsistent accessibility: return type...................... is less accessible than method ......... It was a quite strange error for me as I have not seen the same in past. My classes were defined as:

class MyClass1
{}

class MyClass2
{}

class MyClass3
{}

Solution to this problem is very easy, all I did is add public with all my classes.

public class MyClass1
{}

public class MyClass2
{}

public class MyClass3
{}

And once again, the day is saved by "Powerpuf Girls", I mean by adding public :).

Comments

JV said:

In your case, you were returning a private class in a public method. That indeed won't work, unless the class is also public :)

# June 16, 2009 8:12 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)