i have doubt i don't know what is compile time and what is runtime in C#. i get this words from polymorphism (Method overloading, method overriding) can u explain me. Thank you
-
2I guess Google will help better. – Rites Dec 22 '09 at 07:35
3 Answers
Method overloading is determined at compile time. That means that the compiler knows exactly which code will be executed when you call an overloaded method. It can produce a direct call to the code without adding any checks that would have to be done when the code runs.
Method overriding is determined at runtime. When you call a virtual method the actual method to call is determined from the actual type of the object, and this check has to be done when the call is done. As a reference can potentially reference objects of different types, the compiler can't determine from the reference type which method will be called, so it has to add code for looking up which class to get the method from.

- 687,336
- 108
- 737
- 1,005
The internal actions that are produced when the commands are obeyed by the computer, i.e. at "run time".
Compile time refers to either the operations performed by a compiler (the "compile-time operations"), programming language requirements that must be met by source code for it to be successfully compiled (the "compile-time requirements"), or properties of the program that can be reasoned about at compile time.
Ref:- http://www.cs.bham.ac.uk/research/projects/poplog/primer/node35.html http://en.wikipedia.org/wiki/Compile_time

- 7,662
- 17
- 81
- 129
When you press F6 in VS IDE, you are compiling. The consumed time is compile-time.
When you press F5 or Ctrl+F5 in VS IDE, you are running. The consumed time is run-time.

- 16,949
- 65
- 235
- 452
-
To clarify, what happens first (by default anyway) when you hit F5 or Ctrl+F5 is a build (compiling the program if not compiled already), followed by actually running the program. – jyoungdev Jul 07 '10 at 22:29