Hi there,
These classes and interfaces are empty and contain no runnable code yet; they are only a class or interface definition. That means you can't set breakpoints as the code will never run, and can thus never cause the debugger to break. So:
Quote:
|
Question 1: When I put a breakpoint (to follow the sequence of the program) on "MyComplexClass myObj...." in class Program, it never jumps to one of the classes and interfaces before the class Program. Why not?
|
Because they contain no executable code. Once you add a method (and call that) or a constructor, it'll be called. E.g.:
Code:
internal sealed class MyComplexClass : MyClass, IMyInterface
{
internal MyComplexClass()
{
}
}
If you put a breakpoint on internal MyComplexClass(), it will break.
Quote:
|
Question 2: I cannot set any breakpoint on one of the classes/interfaces before the class Program. Why not?
|
Because they contain no executable code.
Quote:
|
Question 3: I cannot put a "Console.WriteLine();" in one of the classes or interfaces. It gives an error on the "(" with the message "Invalid token '(' in class, ....." Why can I not put a Console.WriteLine() between the {} ?
|
You can't add executable code such as Console.WriteLine in a class definition directly. You need to add it to a member such as a method, property, constructor and so on. This should work:
Code:
internal sealed class MyComplexClass : MyClass, IMyInterface
{
internal MyComplexClass()
{
Console.WriteLine("Constructor called");
}
}
Hope this helps,
Imar