Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Property in a form
Message
From
26/10/2004 11:23:44
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
00954513
Message ID:
00954566
Views:
10
Shawn,

You can think of the get/set of a property as simply "special" methods. Does that help you get your head around it? =)

~~Bonnie



>Bonnie,
>
>Okay, I am going to repeat what you said Bonnie to make sure I got it right.
>
>Basically I would use a property if I want to use the property sheet or have more code fire utilizing the get and set commands.
>
>I would use a protected var or public var or private var just to hold a value and have no need for property sheet or extra code at the get and set commands.
>
>I guess I have one question if the above is right.
>
>If I was to put code on a property using the get and set, I guess why would I just create a method that does what the get and set would have done.
>
>Is it to reduce coding because I would have two methods, where the property is contained in a common area, actually I think I would need two methods if I was using a get and set because, each operation could do something different.
>
>
>Does this make sense....
>
>--> Shawn
>
>>Shawn,
>>
>>It only needs to be public if you need it outside of your class (in this case, outside of your form). If not, then either private or protected is fine.
>>
>>And, if it *does* need to be public, it doesn't necessarily need to be a property (with a get/set), although that's probably better (in case you want to be able to set it via the property sheet, or in case you need to have extra code in the get/set).
>>
>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

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

Click here to load this message in the networking platform