?
Solved

Help with properties

Posted on 2006-07-11
4
Medium Priority
?
197 Views
Last Modified: 2010-04-23
What case(s) would I need to use
ReadOnly or WriteOnly
properties?

I may have a follow-up or two on this, so I'll start it low and increase it if I need further explanation(s0>
Thanx!
0
Comment
Question by:sirbounty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 17086794
Hi sirbounty,

A often use ReadOnly properties for values that are read from the database and which the application cannot change. For example a tax rate.

Another example where a ReadOnly property is useful is for calculated values. Say for example you have a FirstName and a LastName property, you could create a ReadOnly FullName property which would be FirstName + " " + LastName.

I never use WriteOnly properties. About the only place where I can it could make sens (and even there I am not 100% convinced) is for properties like password. You need a way to set the value but you cannot read from it.

Cheers!
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17086810
a ReadOnly property is useful is for calculated values

This may be what I need then...

Say I have
Person.Age
along with today's date.

If wanted to have
Person.BirthDate

could that be a ReadOnly property?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 17086815
sirbounty,

Yes but you should probably better have the BirthDate field in your database (read/write property) and a ReadOnly Age property.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17086838
Yeah - just the quickest example I could come up off the top of my head... ;^)

Thanx, as always.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question