[program-l] C# attributes

  • From: "Shaikh, Saqib, VF UK - Technology" <Saqib.Shaikh@xxxxxxxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Mon, 21 Mar 2005 13:20:39 -0000

Hi

I've been programming in C/C++ for about ten years and Java (my current 
prefered language) for about 5).  I recently started developing in C# and the 
problem is that it is too similar to Java.  This lulls me into a false sense of 
security; but every so often I find something different.  Syntactic differences 
are ok, but what is ahrder is the philosophical differences.

A case in point: what I believe are called attributes.  If I'm right, it feels 
like C# gives one the ability to say classname.attributename instead of 
classname.getAttributename() or set as well.

This is kind of nice, but at the end of the day if I am right it is nothing 
more than syntactic sugar.  What do other people think?  I'd much rather say 
something like:
Label l=new Label("some text", Orientation.CENTER, new Font("arial", 
Font.BOLD|Font.ITALIC));
Component.add(l, x, y);

In C# the way I see it written this would take up at minimum six lines; I'd 
also have to specify the size of the label (I hate doing this), and also the 
tabstop order, etc, giving about nine or ten lines of code in totoal.  As a 
blind person who cursors down through code this is highly annoying.

Can anyone enlighten me as to why this is a good idea?  Are parameters to 
functions old-fashioned? <grin>

Saqib

Saqib Shaikh
Business Analyst
Wholesale Delivery

Telephone: +44 (0)1635 682958
Mobile: +44 (0)7747 461634
Email: saqib.shaikh@xxxxxxxxxxxx

> Vodafone Limited
> Registered Office: Vodafone House, The Connection, Newbury, Berkshire, RG14 
> 2FN
> Registered in England No 2227940
> 
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: