Inconsistent accessibility: property type is less accessible than property
-
I'm not sure why I'm getting this error. First I created an enum in my static main class:
public enum ItemTypes
{
None,
Root,
Clients
}Then I created a class that refers to it:
public class csNodeInfo
{
private csWorkITApp.ItemTypes _ItemType = csWorkITApp.ItemTypes.None;
public csWorkITApp.ItemTypes ItemType
{
get { return _ItemType; }
set { _ItemType = value; }
}private DataAccess.AppDataAccess \_DataRecord = null; public DataAccess.AppDataAccess DataRecord { get { return \_DataRecord; } set { \_DataRecord = value; } }
}
It's erroring on
public csWorkITApp.ItemTypes ItemType
saying "Inconsistent accessibility: property type '...csWorkITApp.ItemTypes' is less accessible than property '...csNodeInfo.ItemType'" Anyone?
Everything makes sense in someone's mind
-
I'm not sure why I'm getting this error. First I created an enum in my static main class:
public enum ItemTypes
{
None,
Root,
Clients
}Then I created a class that refers to it:
public class csNodeInfo
{
private csWorkITApp.ItemTypes _ItemType = csWorkITApp.ItemTypes.None;
public csWorkITApp.ItemTypes ItemType
{
get { return _ItemType; }
set { _ItemType = value; }
}private DataAccess.AppDataAccess \_DataRecord = null; public DataAccess.AppDataAccess DataRecord { get { return \_DataRecord; } set { \_DataRecord = value; } }
}
It's erroring on
public csWorkITApp.ItemTypes ItemType
saying "Inconsistent accessibility: property type '...csWorkITApp.ItemTypes' is less accessible than property '...csNodeInfo.ItemType'" Anyone?
Everything makes sense in someone's mind
-
Is the enum declared w/in the declaration for the static class? If so moving the enum declaration outside of the class declaration will probably fix your problem.
It's monday.... The main class was not public
Everything makes sense in someone's mind
-
It's monday.... The main class was not public
Everything makes sense in someone's mind
yup. The program.cs file Visual creates for you has a static class without explicit scope, making it less than public. Either add
public
to that class, or move your enum out of there. :)Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages