Enum = Already contains a definition...

Posted on 2006-04-11
Last Modified: 2012-05-05

I get the error

The type 'DefaultControlsPlugin.Controls.ElementLabelControl' already contains a definition for 'NameOrDescription'

my code is


public NameOrDescription NameOrDescription
            get { return _eNameOrDescription; }
            set { _eNameOrDescription = value; }


private NameOrDescription _eNameOrDescription;


 public enum NameOrDescription { Name, Description };

Question by:paulwhelan
    LVL 12

    Accepted Solution

    You have an enum with the same name as a property, and I assume they are both declared inside ElementLabelControl - try changing the property name or moving the enum outside the class definition into the namespace.

    LVL 12

    Expert Comment

    You are calling the enum and the property the same name which will not work.  either change the enum name to something like enumNameOrDescription or change the property name
    LVL 12

    Expert Comment

    Oops posted before I saw AGBrowns ciomment
    LVL 12

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    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

    13 Experts available now in Live!

    Get 1:1 Help Now