troubleshooting Question

Forcing Available Property Selections

Avatar of Pretzel_Jesus
Pretzel_Jesus asked on
.NET ProgrammingC#
2 Comments1 Solution289 ViewsLast Modified:
I am not beginning work with custom controls and am fairly new to C#. I am fine setting and getting all of my current properties... what I am wondering is is it possible to pre-assign some variables associated with a property? Meaning if I have a Human Class and one of the properties is HAIRCOLOR... how do I limit the options to a few colors. For instance

Human human = new Human();
human.haircolor = Color.Black //Is Valid
human.haircolor = Color.Brown //Is Valid

No other colors are valid...
Mike Tomlinson
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros