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 337005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:17:44+00:00 2026-05-12T10:17:44+00:00

Is there any existing functionality in the .NET BCL to print the full signature

  • 0

Is there any existing functionality in the .NET BCL to print the full signature of a method at runtime (like what you’d see in the Visual Studio ObjectBrowser – including parameter names) using information available from MethodInfo?

So for example, if you look up String.Compare() one of the overloads would print as:

public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, System.Globalization.CultureInfo culture)

Note the presence of the complete signature with all access and scope qualifiers as well as a complete list of parameters including names. This is what I’m looking for. I could write my own method, but I would rather use an existing implementation if possible.

  • 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-12T10:17:44+00:00Added an answer on May 12, 2026 at 10:17 am

    Unfortunately I don’t believe there is a built in method that would do that. Your best be would be to create your own signature by investigating the MethodInfo class

    EDIT: I just did this

     MethodBase mi = MethodInfo.GetCurrentMethod();
     mi.ToString();
    

    and you get

    Void Main(System.String[])

    This might not be what you’re looking for, but it’s close.

    How about this

    public static class MethodInfoExtension
    {
        public static string MethodSignature(this MethodInfo mi)
        {
            String[] param = mi.GetParameters()
                               .Select(p => String.Format("{0} {1}",p.ParameterType.Name,p.Name))
                               .ToArray();
    
            string signature = String.Format("{0} {1}({2})", mi.ReturnType.Name, mi.Name, String.Join(",", param));
    
            return signature;
        }
    }
    
    var methods = typeof(string).GetMethods().Where( x => x.Name.Equals("Compare"));
        
    foreach(MethodInfo item in methods)
    {
        Console.WriteLine(item.MethodSignature());
    }
    

    This is the result

    Int32 Compare(String strA,Int32
    indexA,String strB,Int32 indexB,Int32
    length,StringComparison
    comparisonType)

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

Sidebar

Related Questions

Are there any free tools to automatically create UML diagrams from an existing .Net/Visual
Are there any existing add-ons which would provide the functionality Upload image from local
Is there any existing jQuery functionality that can test if characters entered into a
Are there any existing libraries in existence that will parse a datetime from a
Are there any existing algorithms for finding and avoiding problematic areas ( swamps ,
I want my Nancy site to accept Google/Facebook/OpenID authentication. Are there any existing solutions
In Guava, if I have a Collection<T> - is there any existing function in
Are there any pre-existing solutions out there which would extend the built in SQL
I want to know if there are any existing benchmarks and sizing information for
Are there any ways to make javac use an existing OSGi-environment for the resolution

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.