syntax for enum?

Posted on 2006-04-11
Last Modified: 2012-08-14

I have a field

private displaytext _eDisplayText;

an enum

private enum displaytext { text, description };

and property

public displaytext DisplayText
            get { return _eDisplayText; }
            set { _eDisplayText = value; }

but it underlines DisplayText in the property and says

Error      16      Inconsistent accessibility: property type 'DefaultControlsPlugin.Controls.ElementLabelControl.displaytext' is less accessible than property 'DefaultControlsPlugin.Controls.ElementLabelControl.DisplayText'      

Any ideas?
Question by:paulwhelan
    LVL 12

    Expert Comment

    You've defined your enum to be private, but are providing a public property to get/set it...

    Just change to

    public enum displayText {..};

    Author Comment

    Great thanks

    Now I had a bool value in there before and I used to do

    if (oElementLabelControl.DisplayText == false)
    How will I change that for enum?


    LVL 12

    Accepted Solution

    if (oElementLabelControl.DisplayText == displaytext.description )

    Or, if your displaytext enum is defined within some class, like:

    class MyClass
      public enum displaytext {..}

    then it'd be

    ....== MyClass.displaytext.description )


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now