Results 1 to 5 of 5

Thread: Do we use 'readonly' or 'writeonly' properties...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    Do we use 'readonly' or 'writeonly' properties...

    In the real world of vb.net, do we usually use 'Readonly' or 'Writelonly' properties at all?

    thank you
    nath

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I use Readonly properties a bit usually for Item properties that are collections and things I only want set in the constructor.
    Last edited by Edneeis; Oct 23rd, 2003 at 02:19 PM.

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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....

  4. #4
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    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.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  5. #5
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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:

    Code:
    // In my operator overload, I 'Or' together the bits
    ForumPermission p = f.Permission + f2.Permission;
    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.
    Last edited by Lethal; Oct 23rd, 2003 at 03:16 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width