Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 373985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:21:41+00:00 2026-05-12T14:21:41+00:00

If I create a dll called xaisoft.dll like this: Using System; Using System.Reflection; [assembly:AssemblyVersion(1.0.0.0)]

  • 0

If I create a dll called xaisoft.dll like this:

Using System;
Using System.Reflection;

[assembly:AssemblyVersion("1.0.0.0")]
public class XaiSoft
{
    public string PrintName()
    {
        return "XaiSoft";
    }
}

and then compile it with

csc /t:library lib.cs

and then create a process assembly to use my library like so:

Using System;
Using System.Reflection;

class App
{
    static void Main()
    {
        ShowAssemblies("Before creating type");
        ShowName();
        ShowAsseblies("After creating type");
    }

    static void ShowName();
    {
        XaiSoft x = new XaiSoft();
        Console.WriteLine("Name: {0}", x.PrintName());
    }

    static void ShowAssemblies(string message)
    {
        Console.WriteLine(message);
        foreach(Assembly a in AppDomain.CurrentDomain.GetAssemblies())
        {
            Console.WriteLine(a.FullName);
        }
     }
}

Now, if I compile the above with csc app.cs /r:XaiSoft.dll

and then run it

I will see that the XaiSoft.dll is loaded even before PrintName from XaiSoft is called.

This brings me to my questions:

I read that the reason it does this is that when the runtime JIT compiles the method, it inlines small methods call by the current method (Main). How small do the methods have to be in order for them to be inlined? and by inlining does it mean it extracts the contents of ShowName and puts it directly in the Main method.

I also read that when once a method is JIT compiled, it is cached in memory, I am a little confused by this. This is only when your application is running right? If I close it down and run it again, does it have to JIT compile my method again?

Can someone explain the statement : To Successfully JIT Compile a method, the runtime must have access to the types used by the method, so the runtime will load the assemblies that contain those types. Is the answer to the previous statement, the runtime will laod the assemblies that contain those types so it can jit compile the method or would changing the access modifier to private prevent it from being jit compiled

Also, does the compiler keep inlining methods within methods that they are called if they are small enough:

For example if I have the following code snippet:

   static void Main()
   {
      ShowName();
   }

   static void ShowName()
   {
      ShowAge();
   }

   static void ShowAge()
   {
       ShowGender();
   }

   static void ShowGender()
   {
     //Show gender code
   }

Would Main inline ShowName, ShowName inline ShowAge, ShowAge inline ShowGender? If it did do that, would it go further and would main end up inlining everything.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:21:41+00:00Added an answer on May 12, 2026 at 2:21 pm

    According to Eric Gunnerson, the method has to be small enough to fit into 32 bytes of IL.

    The criteria listed there are still valid, I believe, except the last one. .NET 3.5sp1 now allows methods that take structs as arguments to be inlined. The current list is:

    • Methods that are greater than 32 bytes of IL will not be inlined.
    • Virtual functions are not inlined.
    • Methods that have complex flow control will not be in-lined. Complex flow control is any flow control other than if/then/else; in this case, switch or while.
    • Methods that contain exception-handling blocks are not inlined, though methods that throw exceptions are still candidates for inlining.

    As for your questions:

    Would Main inline ShowName, ShowName inline ShowAge, ShowAge inline ShowGender?

    The Show*** methods would most likely all get inlined. I do not believe Main would get inlined, especially considering it will become >32 bytes of IL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 176k
  • Answers 176k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The only way I can think to do this would… May 12, 2026 at 3:11 pm
  • Editorial Team
    Editorial Team added an answer A scope with no transaction is usually used as a… May 12, 2026 at 3:11 pm
  • Editorial Team
    Editorial Team added an answer This is likely to be non-trivial to solve in general,… May 12, 2026 at 3:11 pm

Related Questions

If I create a new form called myForm, the top of myForm.h looks like
I am working on writing a wrapper DLL to interface a communication DLL for
please, could someone explain to me a few basic things about working with languages
I have a HttpHandler called Handler that I compile into a DLL and put
I got a DLL generated on VC6 and using wstring , and I'm trying

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.