This online tool can help you to understand how C# source code works with the Just-In-Time compiler(JIT) and the Intermediate Language (IL) code generated by the C# compiler.
If you switch to decompile to C# you can see more information about this simple example.
This decompiles C#, compiles code, then decompiles the generated assembly as C#.
The result of the decompiling process for the source code from the image is this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] public class Program { public static void Main() { Console.WriteLine("Hello World"); } } |
Change your source code with this, see documentation:
1 2 3 4 5 6 7 8 9 10 | using System; using System.Runtime.CompilerServices; [assembly:CompilationRelaxationsAttribute(CompilationRelaxations.NoStringInterning)] public class Program { public static void Main() { Console.WriteLine("Hello World"); } } |
… then decompile to see all changes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: CompilationRelaxations(CompilationRelaxations.NoStringInterning)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] public class Program { public static void Main() { Console.WriteLine("Hello World"); } } |