Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good guidelines on naming bool properties

Generally if there is a property that gets/sets a value for state, I use "Is", like:

Visibility:
.IsVisible

But for properties that gets/sets actions, what is best to use? Like:

Casting shadows:
.CastShadows

Should I use:

.DoesCastShadows

Is there a better alternative?

like image 210
Joan Venge Avatar asked Jan 14 '11 01:01

Joan Venge


1 Answers

Much of the library uses something that would be like .IsShadowCastingEnabled.

For example, UIElement defines IsInputMethodEnabled and IsHitTestVisible.

The nice thing about this is that IsXXX makes it very clear that this is a boolean property.

like image 95
Reed Copsey Avatar answered Nov 02 '22 03:11

Reed Copsey