I thought that C# generated compiled code (by JIT), but I have lately discovered that I can edit code while debugging mode in C# (VS 2008). Does that mean that C# is interpreted?
Asked
Active
Viewed 6,642 times
19
-
2You could edit code while debugging with the Visual C++ 6.0 compiler/IDE in certain circumstances and C++ is fully compiled. It all depends on what the actual code is. – ChrisF May 05 '10 at 22:39
-
Can you give an example? – Betamoo May 05 '10 at 22:40
-
@Betamoo - it's nearly 10 years since I used VC++ 6.0, I can't remember the specifics. Check out the Edit and Continue link @Brian supplied in his comment on @Greg Hewgill's answer. – ChrisF May 05 '10 at 22:45
-
You haven't tried running on 64bit Windows then? "Edit and continue" is ... discontinued. As an aside, I always found edit&continue to be a bit like programming in quicksand and mainly pointless. I don't miss it. – spender May 05 '10 at 22:45
-
@spender: Not correct (at least for .NET). Though you won't be able to use it with the 64-bit CLR: http://blogs.msdn.com/stevejs/archive/2005/11/15/493018.aspx – Dirk Vollmar May 05 '10 at 22:51
-
I wouldn't have needed 64Bit Windows except to use the 64bit CLR (particularly the "more memory" bit), so I didn't know that. – spender May 05 '10 at 22:54
-
Related post - [Is C# partially interpreted or really compiled?](https://stackoverflow.com/q/8837329/465053) & [If C# is not interpreted, then why is a VM needed?](https://stackoverflow.com/q/9556354/465053) – RBT Jul 12 '18 at 08:35
2 Answers
28
It's a trick. The C# compiler/debugger/IDE is just smart and can compile code on the fly while you're debugging.

Greg Hewgill
- 951,095
- 183
- 1,149
- 1,285
-
6It's called "Edit and Continue" or "EnC" for short: http://msdn.microsoft.com/en-us/library/bcew296c(VS.100).aspx – Brian May 05 '10 at 22:41
-
9"Any sufficiently advanced technology is indistinguishable from magic." – spender May 05 '10 at 22:44
7
C# is compiled to IL which is then JIT'ed at runtime into instructions specific to the processor the program is running on.
Editing code while debugging C# is a feature of VS2008 which more than likely compiling any changes in the background

Peter McG
- 18,857
- 8
- 45
- 53