1:
Yes. The compilers compile into IL code, which runs in either system.
Not every library is implemented in Mono, but those that are should work seamlessly. Also, the code has to be written to be independend of the system to work properly, for example:
- Use
Path.DirectorySeparatorChar
and Path.Combine
to form file paths, instead of using the string literal "\" or "/".
- Use the BitConverter class to do byte manipulation that is independend of big-endian / little-endian achitecture.
2:
There may be some differences in what code the compilers generate, but as almost all optimising is done by the JIT compiler that should rarely make any measurable difference.
3:
The exe and dll files does not contain native code, they contain IL code. The native code is generated by the JIT compiler when the exe/dll is loaded.