Connecting Tech Pros Worldwide Forums | Help | Site Map

Intellisense parameter dropdown for enum parameter, How?

msnews.microsoft.com
Guest
 
Posts: n/a
#1: Nov 15 '05
How do I get Intellisense to open a dropdown list box for a method's
parameters when the parameter is an ENUM?

public class MyClass
{
public enum IDkind
{
PersonID,
EntityID,
PlaceID
}

/// <summary>
/// Gets an ID value of a particular KIND
/// </summary>
/// <param name="K">The kind of ID desired</param>
public int IDget(IDkind K)
{
return (int) IDsArray.GetValue(new int[] {(int) K});
}
}
===========================

Then, in another location I type:

MyClass.IDkind IDtype = MC.IDget(

When I type the last parenthesis above, Intellisense automatically opens and
shows me the Method's Signature and my parameter's description, like this:

int MyClass.idGet(MyClass.IDkind K)
K: The kind of ID desired

That's fine .... but now I want Intellisense to open a dropdown list of the
valid MyClass.IDkind enum's to choose from.

How?



Greg Ewing [MVP]
Guest
 
Posts: n/a
#2: Nov 15 '05

re: Intellisense parameter dropdown for enum parameter, How?


frederick, have you tried typing IDKind. int he method signature? After you
type the Enum name it will give you a drop down of the valid values.

--
Greg Ewing [MVP]
http://www.citidc.com

"msnews.microsoft.com" <frederick@qpop.com> wrote in message
news:O9H42yUeDHA.3592@tk2msftngp13.phx.gbl...[color=blue]
> How do I get Intellisense to open a dropdown list box for a method's
> parameters when the parameter is an ENUM?
>
> public class MyClass
> {
> public enum IDkind
> {
> PersonID,
> EntityID,
> PlaceID
> }
>
> /// <summary>
> /// Gets an ID value of a particular KIND
> /// </summary>
> /// <param name="K">The kind of ID desired</param>
> public int IDget(IDkind K)
> {
> return (int) IDsArray.GetValue(new int[] {(int) K});
> }
> }
> ===========================
>
> Then, in another location I type:
>
> MyClass.IDkind IDtype = MC.IDget(
>
> When I type the last parenthesis above, Intellisense automatically opens[/color]
and[color=blue]
> shows me the Method's Signature and my parameter's description, like this:
>
> int MyClass.idGet(MyClass.IDkind K)
> K: The kind of ID desired
>
> That's fine .... but now I want Intellisense to open a dropdown list of[/color]
the[color=blue]
> valid MyClass.IDkind enum's to choose from.
>
> How?
>
>[/color]


Scott C. Reynolds
Guest
 
Posts: n/a
#3: Nov 15 '05

re: Intellisense parameter dropdown for enum parameter, How?


if you are doing this from another class (as I was the other day when i
ran into this), there are two things.

Example 1: Accessing from different class, same namespace

namespace project.namespace1
{
public class MyClass
{
public enum IDkind
{
PersonID,
EntityID,
PlaceID
}

/// <summary>
/// Gets an ID value of a particular KIND
/// </summary>
/// <param name="K">The kind of ID desired</param>
public int IDget(IDkind K)
{
return (int) IDsArray.GetValue(new int[] {(int) K});
}
}
public class OtherClass
{
//here you would reference the enum by
//MyClass.IDKind.PersonID
//tying . after IDKind should pop up the members
}
}

Example 2:
however, if you are going to be referenceing from a different namespace:
namespace someothernamespace
{
public class OtherClass
{
//here you cannot reference the enum by
//MyClass.IDKind.PersonID
}
}
what you would need to do in this case is put the enums you want
accessible OUTSIDE of the class, but inside the namespace
namespace project.namespace1
{
//put enum here
public enum IDkind
{
PersonID,
EntityID,
PlaceID
}
public class MyClass
{
/// <summary>
/// Gets an ID value of a particular KIND
/// </summary>
/// <param name="K">The kind of ID desired</param>
public int IDget(IDkind K)
{
return (int) IDsArray.GetValue(new int[] {(int) K});
}
}
public class OtherClass
{
//now you can just access via the enum name
IDKind.PersonID
//because of shared namespace
//and intellisense will find it.
//and this solves the problem of accessing from another
//namespace as illustrated below
}
}
then in the other namespace,

using project.namespace1
namespace someothernamespace
{
public class someclass
{
//you can just access the enum by name
IDKind.PersonID
//and hitting . will have intellisense bring up the
//members
}
}

hope that helps.


Greg Ewing [MVP] wrote:
[color=blue]
> frederick, have you tried typing IDKind. int he method signature? After you
> type the Enum name it will give you a drop down of the valid values.
>[/color]

Closed Thread