Stupid / Simple question

  • Thread starter Thread starter Doug Handler
  • Start date Start date
D

Doug Handler

Hi,

I'm having a brain block that i hope someone can help me with. I'm trying
to create an application and i want to create several components to be
reused throughout the application. What I'm stuck on is this - I'm using
3rd party components that have enumerated values that I want to present to
my other developers (e.g. Company.Component.VisualStyles.Office2003 or
Company.Component.VisualStyles.OfficeXP), but I can figure out how to do
this. Basically, it's setting a public property, but I'm unsure. Can
someone show me a quick example of how to do this please?

Thanks in advance,
Doug
 
Doug,

Just create an enum:

public enum VisualStyles
{
Office2000 = 0,
OfficeXP = 1,
Office2003 = 2
}

then to use it, use that enum as a datatype:

public void MyTestFunction(VisualStyles styleType)
{
switch (styleType)
{
case VisualStyles.Office2000
{
// it's 2000
break;
}
case VisualStyles.OfficeXP
{
// it's XP
break;
}
}
}


HTH
 
Back
Top