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

  • SEARCH
  • Home
  • 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 6025315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:16:58+00:00 2026-05-23T04:16:58+00:00

Title asks it all, actually, but still, for completeness sake: Hi, I’m writing a

  • 0

Title asks it all, actually, but still, for completeness sake:

Hi, I’m writing a small post-compiling tool in the .NET platform, and while trying to optimize it, I’ve encountered a question I can-not easily find an answer to from the ECMA standards for the Common Language Infrastructure (CLI).

What is the max # of methods a single class can have? Is there a limit?

Edit:

Thanks to Kelsey for pointing out to a real-life test.
Although I still would care about what the actual limit is, for my actual real-life purposes,
I wanted to know if it is 2^16 / 2^32 -or- 2^31-1, as he pointed out, it appears to be clearly above 64K methods per class..

  • 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-23T04:16:59+00:00Added an answer on May 23, 2026 at 4:16 am

    Interesting question but no clue why you would ever hit the limit in reality so the answer might not be that useful because it is a high number.

    I found this thread where someone wrote the following test to actually create a class with increasing amounts of functions to see where the breaking point was:

    namespace MethodCountLimitFinder
    {
        class Program
        {
            [System.STAThreadAttribute]
            static void Main ( string [] args )
            {
                Microsoft.CSharp.CSharpCodeProvider provider = 
                    new Microsoft.CSharp.CSharpCodeProvider() ;
                System.CodeDom.Compiler.CompilerParameters cp = 
                    new System.CodeDom.Compiler.CompilerParameters() ;
                cp.GenerateExecutable = false ;
                cp.GenerateInMemory = true ; 
                System.CodeDom.Compiler.CompilerResults cr = null ;
                System.Text.StringBuilder inner = 
                   new System.Text.StringBuilder ( "namespace Tester { class Test {" ) ;
    
                int methodCount = 1000000 ; 
                while ( true )
                {
                    System.Console.WriteLine ( methodCount ) ;
    
                    for ( int i = methodCount ; i > 0 ; i-- )
                    {
                        inner.AppendFormat ( "void M{0}(){{}}\n" , methodCount++ ) ;
                    }    
                    inner.Append ( "}}" ) ;                
                    cr = provider.CompileAssemblyFromSource ( cp , inner.ToString() ) ;
                    if ( cr.Errors.Count > 0 )
                    {
                        break;
                    }                
                    inner.Remove ( inner.Length - 2 , 2 ) ;
                } 
                foreach (  System.CodeDom.Compiler.CompilerError ce in cr.Errors )
                {
                    System.Console.WriteLine ( ce.ToString() ) ;
                }
            }
        }
    }
    

    Based on the results it looks like it is resource dependent, not the spec which is most likely not hard defined unless you tie it to a 32/64-bit index reference or something which I don’t think is realistic since you will hit a resource limit probably first anyways.

    The test got over 200k+ before failing due to lack of resources.

    Again, interesting but not all that useful of information IMO.

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

Sidebar

Related Questions

The title sums it up but basically I was interested to know if it
The title of the question pretty much sums it all, I want to debug
Title may sound confusing. What I want is to call a constructor of the
Title pretty much sums it up, I think. I'd like to know if it's
The title obviously states it : I can't make the second-level cache work for
The title is pretty self-explanatory. Is there any way to get the headers (except
As the title said, I want to debug some Core Data bugs. Instead of
I hope this title makes sense - I need case-insensitive regex matching on BlackBerry
I hope the title is self explanatory. I can't seem to find a ghc

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.