© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•17mo ago•
6 replies
CEO da CloudFlare

Why ins't inlining working here?

Just doing an experiment. The following code are not inlined by the compiler:

class Program
{
    static void Main(string[] args)
    {
        int k = DoFoo(10, 20);
    }
    
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static int DoFoo(int i, int b)
    {
        return i + b;
    }
}
class Program
{
    static void Main(string[] args)
    {
        int k = DoFoo(10, 20);
    }
    
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static int DoFoo(int i, int b)
    {
        return i + b;
    }
}


https://sharplab.io/#gist:692cc1af66c352c2e8138dad6f033959
SharpLab
C#/VB/F# compiler playground.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Why is my deserialize not working here:
C#CC# / help
3y ago
✅ Why ins't this EF Core query being evaluated client-side?
C#CC# / help
15mo ago