enumerations as options for a custom function?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I was hoping someone could tell me how to declare/create a function so that
when I call for it programatically one of the input parameters appears as a
drop down list of possible options instead of typing in the value.

I believe it has to due with declaring an enumeration but not sure.

Thanks

Chris
 
Chris said:
Hi,

I was hoping someone could tell me how to declare/create a function so
that
when I call for it programatically one of the input parameters appears as
a
drop down list of possible options instead of typing in the value.

I believe it has to due with declaring an enumeration but not sure.

Thanks

Chris


// Define enum:

enum MyValue : int {
Value1 = 0,
Value2 = 1,
Value3 = 2,
Value4 = 3,
Value5 = 4
}

public void DoSomething(MyValue Value)
{
switch (Value) {
case MyValue.Value1:
// Do something.
break;

... handle others too ...
}
}

public void SomethingElse()
{
DoSomething(MyValue.Value1);
}


HTH,
Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top