Click here to Skip to main content
15,881,898 members
Home / Discussions / C#
   

C#

 
GeneralRe: Diff. between properties and fields? Pin
Brian Olej29-Oct-02 8:45
Brian Olej29-Oct-02 8:45 
GeneralRe: Diff. between properties and fields? Pin
Brian Olej26-Oct-02 10:25
Brian Olej26-Oct-02 10:25 
GeneralRe: Diff. between properties and fields? Pin
Kevin McFarlane27-Oct-02 4:56
Kevin McFarlane27-Oct-02 4:56 
GeneralRe: Diff. between properties and fields? Pin
leppie27-Oct-02 5:00
leppie27-Oct-02 5:00 
AnswerRe: Diff. between properties and fields? Pin
LongRange.Shooter28-Oct-02 10:46
LongRange.Shooter28-Oct-02 10:46 
GeneralRe: Diff. between properties and fields? Pin
Brian Olej29-Oct-02 8:46
Brian Olej29-Oct-02 8:46 
GeneralRe: Diff. between properties and fields? Pin
Senkwe Chanda31-Oct-02 2:22
Senkwe Chanda31-Oct-02 2:22 
GeneralRe: Diff. between properties and fields? Pin
LongRange.Shooter31-Oct-02 9:54
LongRange.Shooter31-Oct-02 9:54 
You are correct in stating that I can do:
public readonly int myInteger
and that variable will be in my control as far as it being a computed field. But I still cannot maintain control over that property as to who can access this property, nor can I hide the implementation of the data.

I also was not looking at specific instance examples, but rather full utilization of either public accessors or exposed public fields. So from that all-or-nothing viewpoint, my statement still holds true. Just to make sure we are on the same page....this is the definition I go by:

Encapsulation means that a group of related properties, methods, and other members are treated as a single unit or object. Objects can control how properties are changed and methods are executed. For example, an object can validate values before allowing property changes. Encapsulation also makes it easier to change your implementation at a latter date by letting you hide implementation details of your objects, a practice called data hiding.

From this definition, even if I maintain some amount of encapsulation with the public readonly direction, I also do not hide the implementation of that data. As such, if that integer now has to be long, I just broke my consumer because they know my implementation is integer. Thus I have broken some form of encapsulation. Big Grin | :-D

_____________________________________________
I have a tendancy to where my mind on my sleeve
I have a habit of losing my shirt...

GeneralNamed pipes Pin
EricK726-Oct-02 9:39
sussEricK726-Oct-02 9:39 
GeneralRe: Named pipes Pin
Daniel Turini26-Oct-02 9:50
Daniel Turini26-Oct-02 9:50 
GeneralRe: Named pipes Pin
EricK729-Oct-02 5:26
sussEricK729-Oct-02 5:26 
QuestionHow can I . . . Pin
Venet25-Oct-02 23:43
Venet25-Oct-02 23:43 
AnswerRe: How can I . . . Pin
Stephane Rodriguez.26-Oct-02 0:31
Stephane Rodriguez.26-Oct-02 0:31 
GeneralRe: How can I . . . Pin
Venet26-Oct-02 1:04
Venet26-Oct-02 1:04 
GeneralRe: How can I . . . Pin
Stephane Rodriguez.26-Oct-02 2:26
Stephane Rodriguez.26-Oct-02 2:26 
GeneralRe: How can I . . . Pin
Venet26-Oct-02 2:33
Venet26-Oct-02 2:33 
AnswerRe: How can I . . . Pin
ian mariano28-Oct-02 4:38
ian mariano28-Oct-02 4:38 
GeneralRe: How can I . . . Pin
Venet31-Oct-02 5:40
Venet31-Oct-02 5:40 
QuestionHow to send message to a form in C#? Pin
Solmyr24-Oct-02 19:19
Solmyr24-Oct-02 19:19 
AnswerRe: How to send message to a form in C#? Pin
Stephane Rodriguez.24-Oct-02 21:56
Stephane Rodriguez.24-Oct-02 21:56 
GeneralRe: How to send message to a form in C#? Pin
Mazdak25-Oct-02 8:48
Mazdak25-Oct-02 8:48 
GeneralRe: How to send message to a form in C#? Pin
Tom Archer25-Oct-02 13:59
Tom Archer25-Oct-02 13:59 
GeneralRe: How to send message to a form in C#? Pin
Stephane Rodriguez.25-Oct-02 19:26
Stephane Rodriguez.25-Oct-02 19:26 
Generaldata bases Pin
imran_rafique24-Oct-02 16:44
imran_rafique24-Oct-02 16:44 
GeneralRe: data bases Pin
Rickard Andersson2025-Oct-02 0:15
Rickard Andersson2025-Oct-02 0:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.