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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:13:00+00:00 2026-05-11T03:13:00+00:00

I was just participating in Stack Overflow question Is everything in .NET an object?

  • 0

I was just participating in Stack Overflow question Is everything in .NET an object?.

And one poster (in comments of accepted answer) seemed to think that performing a method call on a value type resulted in boxing. He pointed me to Boxing and Unboxing (C# Programming Guide) which doesn’t exactly specify the use case we’re describing.

I’m not one to trust a single source, so I just wanted to get further feedback on the question. My intuition is that there is no boxing but my intuition does suck. 😀

To further elaborate:

The example I used was:

int x = 5; string s = x.ToString(); // Boxing?? 

Boxing does not occur if the struct in question overrides the method inherited from the object as the accepted answer here states.

However if the struct doesn’t override the method, a ‘constrain’ CIL command is executed prior to a callvirt. According to the documentation, OpCodes.Constrained Field, this results in boxing:

If thisType is a value type and thisType does not implement method then ptr is dereferenced, boxed, and passed as the ‘this’ pointer to the callvirt method instruction.

  • 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. 2026-05-11T03:13:01+00:00Added an answer on May 11, 2026 at 3:13 am

    Here’s the IL for your code:

    L_0001: ldc.i4.5      // get a 5 on the stack L_0002: stloc.0       // store into x L_0003: ldloca.s x    // get the address of x on the stack L_0005: call instance string [mscorlib]System.Int32::ToString()  // ToString L_000a: stloc.1       // store in s 

    So the answer in this case is no.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Found the problem. loadNewVideo('11mrMppgfrQ','0'); play(); were calling before function onYouTubePlayerReady(playerId)… May 11, 2026 at 11:37 pm
  • Editorial Team
    Editorial Team added an answer Briefly, it's to make the class abstract, so that it… May 11, 2026 at 11:37 pm
  • Editorial Team
    Editorial Team added an answer Something like: Collections.sort(records, new Comparator<List<String>>() { public int compare(List<String> o1,… May 11, 2026 at 11:37 pm

Related Questions

To preface, I've seen the command to answer this question before, but now I
I'm trying to design a database for a sports meeting. I think I've got
I was just looking through some information about Google's protocol buffers data interchange format.
I was just wondering if there is an elegant way to set the maximum

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.