473,394 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

enums and intellisense

Anybody know how to make intellisense show a drop down the list of an enum
as a method argument like it does for .NET types?

Example:

public enum eGroupPlacements
{
GRP_RECORD,
GRP_REPORT
};

private void PlaceGroups(eGroupPlacements egrp)
{
// do something here
}

When I call the PlaceGroups method shouldn't I get a list of all the enum
members in the eGroupPlacements enumeration? How can I make that happen?

Thanks in advance for your help.
Steve
Nov 15 '05 #1
1 4281
The C# language requires that enum values be qualified by enum types, so
instead of "GRP_RECORD", you will be writing "eGroupPlacements.GRP_RECORD".
Therefore to get intellisense on enum values, you have to write
"eGroupPlacements." first (intellisense can help you write this part too).

This may seem a step backward compared with how it's done in C++, but it
reduces chances for name clashing. For example, you can now have two enum
types to share the same enum value names:

enum Foo
{
Red, Green, Blue
};

enum Bar
{
Red, Black
};

- Zhanyong Wan

Visual Studio and .NET Setup

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included samples (if any) is subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
| From: "Peter Rilling" <pe***@nospam.rilling.net>
|
| If you are referring to the way VB.NET handles enum parameters, C# does
not
| have this capability. You have to explicitly write the enumeration name
and
| then you get this list of possible values, the list does not appear
| automatically.
|
| "Steve Long" <No***************@co.clark.wa.us> wrote in message
| news:#H**************@TK2MSFTNGP10.phx.gbl...
| > Anybody know how to make intellisense show a drop down the list of an
enum
| > as a method argument like it does for .NET types?
| >
| > Example:
| >
| > public enum eGroupPlacements
| > {
| > GRP_RECORD,
| > GRP_REPORT
| > };
| >
| > private void PlaceGroups(eGroupPlacements egrp)
| > {
| > // do something here
| > }
| >
| > When I call the PlaceGroups method shouldn't I get a list of all the
enum
| > members in the eGroupPlacements enumeration? How can I make that happen?
| >
| > Thanks in advance for your help.
| > Steve
| >
| >
|
|
|

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: SpaceCowboy | last post by:
I recently got into a discussion with a co-worker about using enums across a dll interface. He wanted to use chars instead, argueing that depending on compiler settings the size of an enum could...
2
by: Faisal | last post by:
Can anyone tell me if it is possible to enumerate through all the Enums within a class . I have a class with many Enums and would like to accees the Enums through an array/collection etc. I can't...
2
by: Jim Heavey | last post by:
I created a class with an Enum and a Property. In another class I instatiate that class (with an Enum and a Property), but I can't seem to access it? My code looks like the following: ...
2
by: SpotNet | last post by:
Hello CSharpies, Can Enums in C# be UInt32 Types, and not just Int32 Types. I have a lot of constant declarations that are UInt32 that I want to put in Enums to ease the use of Intellisence. I...
4
by: Martin Pritchard | last post by:
Hi, I'm working on a project that historically contains around 40 enums. In the database various fields refer to the int values of these enums, but of course ref integrity is not enofrced and...
2
by: Simon Elliott | last post by:
I have some legacy C++ code which requires some enums to be 1 or 2 bytes in size. I'd ideally like to be able to specify that a few carefully selected enums are a particular size. By default,...
11
by: Marc Gravell | last post by:
This one stumped me while refactoring some code to use generics... Suppose I declare an enum MyEnum {...} Is there a good reason why MyEnum doesn't implement IEquatable<MyEnum> ? Of course,...
13
by: Bob | last post by:
Hi, Can someone explain why you can't declare enums in an interface? The compiler says "interfaces can't declare types" Ignoring the syntax implications it seems to me that you should be able to...
4
by: Just Me | last post by:
I keep hitting the same minor problem, but dont have a really great solution. So Im looking for ideas. There are many instances where I want to force the developer ( me ) from a readability...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.