What is wrong with this code ?
public ScreenManager _ScreenManager
{
get { return screenManager; }
internal set { screenManager = value; }
}
ScreenManager screenManager;
and I get this error:
Inconsistent accessibility: field type 'ScreenSystem.ScreenManager' is less accessible than field 'ScreenSystem.Screen.ScreenManager'
I'm going to assume the type
ScreenManager
isinternal
while the class containing your property is public.The compiler is saying that a publicly-accessible field (
ScreenSystem.Screen.ScreenManager
) is of a type (ScreenSystem.ScreenManager
) that isn't publicly-accessible.Your field should generally be
private
anyway. And you might be missing apublic
in front of your classScreenSystem.ScreenManager
(it defaults tointernal
IIRC).It means that you have
ScreenManager
set up as private or protected yet you are are trying to make a property public that relies onScreenManager
. You can't do that.Make
ScreenManager
public or make_ScreenManager
the same accessibility asScreenManager
.Here is your scenario:
Here are the solutions, depending on what you're trying to do:
Screen
class internalScreenManager
class publicScreenManager
class public and theScreen
class internalScreen.Manager
property internal (and remove the internal set accessor)Either one of the above will compile without errors. It really just depends on what you're trying to achieve.