List Info

Thread: Interview Questions March 2, 2006




Interview Questions March 2, 2006
user name
2006-03-02 15:45:27
I bet whoever wrote it originally had the property exposed. 
They've
reviewed the code, tightened down the scope and neglected to
pay
adequate attention.
I think the code's madness. It's about as clever as
assigning an event
handler for an object's own event. Code should always be as
simplified
as possible for support purposes.
If you wanted it public, and there's no logic applied to
the Get or Set
accessors, why not just make the private internal variable
public and do
away with the get/set?  I know in the "old" COM
days there was a risk of
changing a property's UID, but .NET does away with that,
doesn't it?
Maybe someone will tell me different?

-----Original Message-----
From: CSDevelopersgooglegroups.com
[mailto:CSDevelopersgooglegroups.com] On Behalf Of
themanfromsql
Sent: 02 March 2006 15:37
To: C# Developers
Subject: Interview Questions March 2, 2006


Design question:  can you think of any situations where you
would want
to use a private read/write property to wrap a private
member?

Example:

private string fishHead = "";
private string FishHead
{
	get
	{
		return this.fishHead;
	}

	set
	{
		this.fishHead = value;
	}
}

I'm supporting a WinForms project and I notice several
places where a
private member is wrapped like this with no validation or
additional
logic in the getting and setting of the member.  

Any thoughts?



************************************************************
********** 
Please visit the official ITV website at www.itv.com
for the latest company news.

This email and any files transmitted are confidential and
intended 
solely for the use of the individual or entity to which they
are 
addressed. If you have received this email in error, please
notify 
postmasteritv.com 

Thank you.
************************************************************
**********

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C# Developers" group.
To post to this group, send email to CSDevelopersgooglegroups.com
To unsubscribe from this group, send email to
CSDevelopers-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/CSDevelopers
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )