Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Inconsistent accessibility: property type is less accessible than property

Inconsistent accessibility: property type is less accessible than property

Scheduled Pinned Locked Moved C#
csshelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • K Kevin Marois

      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

      J Offline
      J Offline
      J 0
      wrote on last edited by
      #2

      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.

      K 1 Reply Last reply
      0
      • J J 0

        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.

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #3

        It's monday.... The main class was not public

        Everything makes sense in someone's mind

        L 1 Reply Last reply
        0
        • K Kevin Marois

          It's monday.... The main class was not public

          Everything makes sense in someone's mind

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          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


          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups