In the real world of vb.net, do we usually use 'Readonly' or 'Writelonly' properties at all?
thank you
nath
Printable View
In the real world of vb.net, do we usually use 'Readonly' or 'Writelonly' properties at all?
thank you
nath
I use Readonly properties a bit usually for Item properties that are collections and things I only want set in the constructor.
I use readonly here every now and then. Most of the time it is both for my objects.
I haven't had much of a reason to make a write only property. I figure if the user can write to the property, why shouldn't they be able to see it later? They obviously knew it at one point....
Read-only is about the only one of the two that I use...I have yet to find a significant reason to use write-only.
I extended the Infragistics UltraGrid control a few months back and exposed a readonly property called LastActiveRow. It's readonly in the sense that I only use a Getter, not the readonly keyword. I can't say I use them all the time, but they have their moments.
OFF TOPIC
Also, I finally had an opportuntiy to use operator overloading!!
;)
In my forum system, a user can belong to multiple roles, where permissions can clash. I used bitmasking and operator overloading for my permissions engine. So now, I can do something like this:
The whole thing is actually pretty solid and I plan on using it in future projects. If anyone would like to see the code, shoot me an email.Code:// In my operator overload, I 'Or' together the bits
ForumPermission p = f.Permission + f2.Permission;