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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:21:16+00:00 2026-05-13T15:21:16+00:00

I have read that ToString() uses reflection (although it should just put quotation marks

  • 0

I have read that ToString() uses reflection (although it should just put quotation marks around the object it is called on so I don’t know where/why it may use reflection). Is there any proof of this? And is there any performance penalty of calling .ToString() (maybe I should call Convert.ToString()?)?

  • 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-13T15:21:16+00:00Added an answer on May 13, 2026 at 3:21 pm

    If you don’t override the ToString() method, you end up calling Object.ToString(), whose implementation looks something like this:

    public virtual string ToString()
    {
        return this.GetType().ToString();
    }
    
    [MethodImpl(MethodImplOptions.InternalCall), SecuritySafeCritical]
    public extern Type GetType();
    

    The method doesn’t simply “put quotation marks around the object it is called on”. In order to accomplish that result, it must reflectively get the runtime type information and call ToString() on that, which in turn looks something like this:

    public override string ToString()
    {
        return ("Type: " + this.Name);
    }
    

    Anytime you go through reflection for something there is a bit of a performance penalty, but in this case probably not one large enough to really matter – unless you are doing it inside of a very tight, very large loop.

    Are you seeing a performance problem? What are you trying to accomplish that is leading you to want to call Object.ToString() rather than calling an overridden version that you provide?

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

Sidebar

Related Questions

I have a few Oracle procedures that generate/return a large amount of data that
I have two linqTOsql entities that has a parent and child relationship, one to
I am experimenting with Mongodb and NoRM in C#. From what I have read
I've been working on this issue for a couple days and have read several
I'm trying to read XML that is being pushed to my java app. I
I have to do read an Large InputStream comming from a URL. I loaded
Good Morning, I have created my first generic method pieced together from a bunch
I have used this code var dest1 = File.AppendText(Path.Combine(_logFolderPath, log1.txt)); dest1.WriteLine(line.Trim()); to write to
At present i have a the following code populating a datagridview showing the user
currently I use DataSet to read data from ADO.NET SQL provider, but I read

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.