Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 19, 2008 03:39 PM by SilverStyle
Mar 17, 2008 12:46 PM|LINK
I have a class property of type enum. The enum name is TemplateType:
Private _Type As TemplateType
Public Property Type() As TemplateType
Set(ByVal value As TemplateType)
_Type = value
I need to run some code if a Type was defined. If Type wasn't defined then I will not run this code.
How can I do this?
Should I add a Enum item named None and make it the default value?
Mar 17, 2008 01:24 PM|LINK
Yeah personally I would add an "Unknown" or "None" value into the enum. Another approach is to use:
Nullable<TemplateType> then it can contain null?!
Mar 19, 2008 03:39 PM|LINK
Personally, I also think, that it's a good strategy to provide a "None" ur "Undefined" item in an enumeration, providing it with the index 0.
Then you can easily query the variable of type YourEnumeration if it's greater than 0.