I'm trying to produce some "Hello World" size C# code snippet that would incur JIT inlining. So far I have this:
class Program
{
static void Main(string[] args)
{
Console.WriteLine( GetAssembly().FullName );
Console.ReadLine();
}
static Assembly GetAssembly()
{
return System.Reflection.Assembly.GetCallingAssembly();
}
}
which I compile as "Release"-"Any CPU" and "Run without debugging" from Visual Studio. It displays the name of my sample program assembly so clearly GetAssembly()
is not inlined into Main()
, otherwise it would display mscorlib
assembly name.
How do I compose some C# code snippet that would incur JIT inlining?