Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: Multi-Column Listbox :: C# Pin
valikac21-Nov-02 9:59
valikac21-Nov-02 9:59 
GeneralRe: Multi-Column Listbox :: C# Pin
ian mariano20-Nov-02 3:05
ian mariano20-Nov-02 3:05 
Questioni have two threads and make a group of it? Pin
imran_rafique19-Nov-02 16:31
imran_rafique19-Nov-02 16:31 
AnswerRe: i have two threads and make a group of it? Pin
Joshua Nussbaum19-Nov-02 20:57
Joshua Nussbaum19-Nov-02 20:57 
Questionwhy use property in class? Pin
zhoujun19-Nov-02 14:40
zhoujun19-Nov-02 14:40 
AnswerRe: why use property in class? Pin
Christian Graus19-Nov-02 19:43
protectorChristian Graus19-Nov-02 19:43 
AnswerRe: why use property in class? Pin
ian mariano20-Nov-02 2:52
ian mariano20-Nov-02 2:52 
AnswerRe: why use property in class? Pin
LongRange.Shooter21-Nov-02 10:07
LongRange.Shooter21-Nov-02 10:07 
Your library of 'functions' becomes your class. So a definition of class is a collections of methods that perform similar functions.

The methods can get information passed to them using parameters or you can expose properties. Likewise you can have a method that you call which sets several values internally that you can retreive using properties.

Properties is a means of exposing private information within your class to the public. An advantage of doing this is many fold:

When a public consumer of your class puts data into a property you can hide complex calculations and processes that may be applied to that data. In a simple classroom example I show someone setting the number of gallons of beer the classroom is about to brew. Internally, I break that information out into the number of gallons, number of liters, computed weight by gallon in pounds, and computed weight in grams. All the user knows is that when they set gallons they can 'easily' find out how much they are making in liters.

Another benefit is something called data hiding. If you expose your public properties using simple data types, you can shelter the user of your class from any changes in the actual data behind the scenes. Your get/set properties handle the converstion of the data from the complex data types into the simple data types without their knowledge.

In general you can think of your class like a castle. Things go on inside of it that only those who are priveledged to be inside know what is happening. The properties are like small windows in the castle that let you see glimpses of whatever you are allowed to see within the castle. If you tell a courier at the door that troops must be sent to the north wall, you don't know everything that goes on to actually get those troops there. You just know it happens and your request is satisfied.

In practice, a well managed class library can be developed and tested once. Each time it is reused you only have to test your USE of the class, not the implementation within the class.

_____________________________________________
The world is a dangerous place.
Not because of those that do evil,
    but because of those who look on and do nothing.

Questionhow to display bitmap in MDI form Pin
Linder Wang19-Nov-02 14:19
sussLinder Wang19-Nov-02 14:19 
GeneralCollection editor problem Pin
dacris19-Nov-02 11:24
dacris19-Nov-02 11:24 
GeneralRe: Collection editor problem Pin
leppie19-Nov-02 11:36
leppie19-Nov-02 11:36 
GeneralRe: Collection editor problem Pin
dacris19-Nov-02 12:14
dacris19-Nov-02 12:14 
QuestionUnfocus a form when it's created? Pin
Bog19-Nov-02 8:53
Bog19-Nov-02 8:53 
AnswerRe: Unfocus a form when it's created? Pin
LongRange.Shooter19-Nov-02 11:13
LongRange.Shooter19-Nov-02 11:13 
AnswerRe: I don't understand your q very well, but.. Pin
Masaaki Onishi19-Nov-02 19:20
Masaaki Onishi19-Nov-02 19:20 
GeneralSplit string by string Pin
dezoe19-Nov-02 6:43
dezoe19-Nov-02 6:43 
GeneralRe: Split string by string Pin
leppie19-Nov-02 11:12
leppie19-Nov-02 11:12 
GeneralRe: Split string by string Pin
Eric Gunnerson (msft)19-Nov-02 11:25
Eric Gunnerson (msft)19-Nov-02 11:25 
GeneralRe: Split string by string Pin
dezoe19-Nov-02 12:41
dezoe19-Nov-02 12:41 
QuestionEnabled ForeColor? Pin
Delegate19-Nov-02 6:41
Delegate19-Nov-02 6:41 
GeneralSqlReader.GetValues() problem Pin
leppie19-Nov-02 6:32
leppie19-Nov-02 6:32 
GeneralRemoving EnhancedMetafile from clipboard fails Pin
gharrison19-Nov-02 5:27
gharrison19-Nov-02 5:27 
GeneralCOM+ Windows API Pin
thematt19-Nov-02 2:52
thematt19-Nov-02 2:52 
GeneralRe: COM+ Windows API Pin
leppie19-Nov-02 11:07
leppie19-Nov-02 11:07 
GeneralRe: COM+ Windows API Pin
thematt20-Nov-02 2:21
thematt20-Nov-02 2:21 

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.