Recently in one of the interview, I faced this tricky question, "What is the advantage for compiling to intermediate code instead of native code directly?"
This is a tricky question. However, i read an article written by .NET team member Eric Lippert about the same topic.
Converting to Intermediate code has few advantages over direct conversion of native code. As so many languages comes under .NET framework, and all source code of these languages has to support conversion into native code in different platforms.
Say, if there are "m" number of languages, and these supports "n" number of platforms, it will take "m"x"n" implementations, if source code is directly converted to native code.
By introducing Intermediate Language concept, it required only "m" + "n" different implementations, as all languages has to implement only conversion to intermediate code. This approach results in less coding effort for language implementer.
C# Interview Questions and Answers · · · ·