I would personally tend to agree the C# syntax is cleaner... but I don't
think the difference is all that big frankly and it probably comes down to
a matter of developer proference rather than what's actually "better" in
some way.

They both functionally *DO* the same thing though... your executing code
to set and get private properties of an object.  The original topic here
is "DTOs are evil", and it seems to me that the syntax of C# wouldn't
change a persons' opinion on that question, right?

I mean, if DTOs are evil in your mind, they aren't suddenly *NOT* evil
simply because C# might offer a syntax you like more, does it? :)  The
example you gave in C# is functionally equivalent to the Java version, so
if the basic premise is dealing with what should actually happen in the
getters and setters, C# doesn't make the situation better in that regard.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, August 5, 2005 9:18 am, Larry Meadors said:
> You don't see it?!? Have you looked?
>
> As a self-professed Java bigot, I will readily admit that C# has a
> *way* better sytax for defining and using properties that I wish Java
> would implement (or even better - improve upon).
>
> public string MyProperty {
>       get { return myProperty; }
>       set { myProperty = value; }
> }
>
> Now, instead of:
>
> someValue = foo.getMyProperty();
> foo.setMyProperty(someValue);
>
> ...I can do this instead:
>
> someValue = foo.MyProperty;
> foo.MyProperty = someValue;
>
> IMO, the second form is MUCH clearer, and provides all of the benefits
> of a get/set pair.
>
> Larry
>
>
> On 8/5/05, Leon Rosenberg <[EMAIL PROTECTED]> wrote:
>>
>> Sorry, I don't see it.
>>
>> Example:
>> private String mail;
>> public String getMail(){
>> return mail;
>> }
>>
>> public void setMail(String aMail){
>> mail = aMail;
>> }
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to