Custom Data Types

advertisements

I'd like to create some custom data types, but I don't think I'm asking the right question(s).

There are "compound Boolean" values used throughout .NET, and I want to design some of my own. I've been using a series of Boolean variables, which works, but just isn't the same.

Examples from .NET include: Color.Black Alignment.Centered [fontProperties].Bold* *I forget the actual name, but you get the idea

I want to make something like this:

ColorSortQualities

  • None
  • DistinguishColor
  • DistinguishNumberOfColors
  • DistinguishColorPattern

Once that's been declared, I could do this: if(searchOptions.ColorSortQualities == DistinguishColor) [do stuff]

What is this called?

Thanks!


It's called an enumeration and in C# you use the keyword enum.