JDYoder Posted March 22, 2005 Posted March 22, 2005 I have a class I'm exposing to the user via the PropertyGrid, so my property names have to make sense. One of the properties needs to be "Optional." Normally, the code in my class would simply be as follows... Private mbOptional As Boolean <System.ComponentModel.Category("Behavior"), _ System.ComponentModel.DefaultValue(False)> _ Public Property Optional() As Boolean Get Return mbOptional End Get Set(ByVal vOptional As Boolean) mbOptional = vOptional End Set End Property However, the word "Optional" as a property name is not allowed since it's a reserved word. But it seems there should be a way to have a Property with any name you want, whether it's "Optional", "Integer", or whatever. Any ideas on how it's possible, or isn't it? Quote
JDYoder Posted March 23, 2005 Author Posted March 23, 2005 Well, what do you know -- that worked perfectly! Thanks a ton! :) Quote
*Experts* Nerseus Posted March 30, 2005 *Experts* Posted March 30, 2005 Just a suggestion - property names are generally nouns, not adjectives. You could use an adjective and noun - maybe something OptionalColor. In six months, you'll be typing [class]. and the intellisense is going to show you "Optional" and you'll think - what goes in *there*?? -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.