Is it possible to write majority of your program in say C# and then drop down and do certain functions/objects in C or C++?
I know you can call pre-compiled .dlls from C#; but can you do ‘inline’ native C directly from C#? Do they have to be “managed” .dlls?
If not, I’m assuming there is a JNI like interface?
Also, another question; can you compile C# down into “native” machine code?
MSVS2010/Win7 if it matters.
You can’t inline C code in C# – if you want to write part of your code in C then you will need to cross some sort of interop layer in order to call that C code, for example P/Invoke or Managed C++.
You can however inline C (or even assembly) in Managed C++, allowing you to combine native code and managed code in a single assembly / dll.
For the .Net equivalent of JNI, (native code calling managed code) the normal method is to either use COM interop or Managed C++ – you can also host the CLR, but this is less common.
As for compiling C# down into “native” machine code, read up on NGen.