Click here to Skip to main content
15,915,336 members
Home / Discussions / C#
   

C#

 
GeneralRe: Serialization Pin
geekfromindia29-Feb-08 10:40
geekfromindia29-Feb-08 10:40 
GeneralGps guided vehicle Pin
RED FOX29-Feb-08 6:53
RED FOX29-Feb-08 6:53 
Generaltimer for 5 seconds. Pin
tingu29-Feb-08 5:56
tingu29-Feb-08 5:56 
GeneralRe: timer for 5 seconds. Pin
led mike29-Feb-08 6:17
led mike29-Feb-08 6:17 
GeneralRe: timer for 5 seconds. Pin
Not Active29-Feb-08 6:19
mentorNot Active29-Feb-08 6:19 
QuestionAll methods called when class instantiated? Pin
stuebbie29-Feb-08 4:48
stuebbie29-Feb-08 4:48 
AnswerRe: All methods called when class instantiated? Pin
led mike29-Feb-08 5:04
led mike29-Feb-08 5:04 
GeneralRe: All methods called when class instantiated? Pin
stuebbie29-Feb-08 5:17
stuebbie29-Feb-08 5:17 
Hi,

Thanks for the quick reply Smile | :) I didn't expect my colleague to come up with any answers, but it was worth a try!

1) so you have a class foo and when you new an instance of foo all the protected methods of the object are executed?

This is correct. Further to this (apologies for not mentioning), every time that I provide data to the instantiated object, via its exposed property gets, the protected methods are run again, and the private int counter is incremented again.

2) Furthermore if you put a break point in one of those methods it will not break there?

This is correct. The only time that the break point's for the protected methods are executed is when I call them from public property gets.

3) But you are sure it is executing, how?

Using Visual Studio 2005, I have set up a watch on the private int that i set up within the class for counting purposes. I set it up in the following way:

private int m_foo = 0;

When I instantiate the class foo, m_foo is set to 1. When I set foo.SomeProperty = "bar", m_foo is then set to 2. And so on, when I assign values to properties, the m_foo variable is incremented. I also set up some Debug.WriteLine commands within the protected methods, and I can view the output from these Debug objects in the output window.



It's ever so frustrating as it is probably something very small that I have missed out.

Thanks again,

Stuart
GeneralRe: All methods called when class instantiated? [modified] Pin
led mike29-Feb-08 5:54
led mike29-Feb-08 5:54 
AnswerRe: All methods called when class instantiated? Pin
Not Active29-Feb-08 5:07
mentorNot Active29-Feb-08 5:07 
GeneralRe: All methods called when class instantiated? Pin
led mike29-Feb-08 5:10
led mike29-Feb-08 5:10 
GeneralRe: All methods called when class instantiated? Pin
Not Active29-Feb-08 5:27
mentorNot Active29-Feb-08 5:27 
GeneralRe: All methods called when class instantiated? Pin
stuebbie29-Feb-08 5:29
stuebbie29-Feb-08 5:29 
GeneralRe: All methods called when class instantiated? Pin
stuebbie29-Feb-08 5:34
stuebbie29-Feb-08 5:34 
GeneralRe: All methods called when class instantiated? Pin
Guffa29-Feb-08 6:06
Guffa29-Feb-08 6:06 
GeneralRe: All methods called when class instantiated? Pin
J4amieC29-Feb-08 6:22
J4amieC29-Feb-08 6:22 
AnswerRe: All methods called when class instantiated? Pin
Mark Churchill29-Feb-08 5:15
Mark Churchill29-Feb-08 5:15 
GeneralRe: All methods called when class instantiated? Pin
codemunch29-Feb-08 5:50
codemunch29-Feb-08 5:50 
AnswerRe: All methods called when class instantiated? Pin
stuebbie29-Feb-08 6:00
stuebbie29-Feb-08 6:00 
GeneralRe: All methods called when class instantiated? Pin
stuebbie29-Feb-08 5:53
stuebbie29-Feb-08 5:53 
GeneralRe: All methods called when class instantiated? Pin
codemunch29-Feb-08 5:56
codemunch29-Feb-08 5:56 
QuestionEvent handling in Context menu of TreeView node [modified] Pin
RobSmith7729-Feb-08 4:39
RobSmith7729-Feb-08 4:39 
GeneralRe: Event handling in Context menu of TreeView node Pin
led mike29-Feb-08 5:08
led mike29-Feb-08 5:08 
GeneralRe: Event handling in Context menu of TreeView node Pin
RobSmith7729-Feb-08 5:13
RobSmith7729-Feb-08 5:13 
General3tier Pin
Trustapple29-Feb-08 4:37
Trustapple29-Feb-08 4:37 

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.