Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Method vs. Property
Message
From
11/10/2005 15:39:54
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01058026
Message ID:
01058053
Views:
13
Just my opinion, of course, but it made sense to me too. =)

~~Bonnie



>Bonnie,
>That makes sense. Method it is.
>Thanks,
>Einar
>
>>Einar,
>>
>>Given that the properties you want to set are already publicly exposed, I'd say it makes more sense to have a Method to set them all at once. Plus, having a property for this doesn't really make sense, because you're not setting a Property called PropertyName, you're setting all the other ones.
>>
>>~~Bonnie
>>
>>
>>>I have been discussing pros and cons with myself now for about 15 minutes, whether I should use a method or a property. Now I am seeking some input form somebody else other than myself LOL
>>>
>>>I have a usercontrol with several widgets on it. In addition to having properties to get/set each of the widgets individualy I would like to add a method or a property to set/get all the widgets at the same time, by passing/returning a byte array. I just can't make up my mind if I should use a method to do this or a property.
>>>
>>>
>>>public void MethodName (byte[] paraBA)
>>>{
>>>  //code
>>>}
>>>
>>>public byte[] MethodName ()
>>>{
>>>  //code
>>>}
>>>
>>>or
>>>
>>>public byte[] PropertyName
>>>{
>>>  get
>>>  {
>>>    //code
>>>  }
>>>  set
>>>  {
>>>    //code
>>>  }
>>>}
>>>
>>>
>>>I guess at the end of the day it doesn't really matter, but I would like to know your opinion.
>>>
>>>
>>>Thanks,
>>>Einar
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform