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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:21:02+00:00 2026-05-28T05:21:02+00:00

I understand how to go between the 2 different types but my question is;

  • 0

I understand how to go between the 2 different types but my question is; why is this difference at the type level?

I would have thought it would be a property of the ParamterInfo object, not separate special type.

Assuming it’s presented as a separate type in reflection because that is how it is internally, what language benefits are there to having this as a separate type (I’m guessing easier method overload resolution or something)?

On a similar note, why does ref make a distinct type but out doesn’t (I can’t think of reasons for ref being a separate type, that don’t apply to out)?

  • 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-28T05:21:03+00:00Added an answer on May 28, 2026 at 5:21 am
    public static int SomeMethod(string local, ref string strParam)
    {
      local = SomeStaticlyHeldString;
      strParam = SomeStaticlyHeldString;
      int localInt = local.Length;
      return strParam.Length;
    }
    

    The assignment to local means that the place in memory that local labels now points to the same object that SomeStaticlyHeldString was pointing to.

    The assignment to strParam means that the place in memory that the argument passed to the method using ref labels, now points to the same object that SomeStaticlyHeldString was pointing to.

    Obtaining local.Length queries the object that local points to. Obtaining strParam.Length queries the object that the variable that strParam points to, points to.

    The two are really behaving very differently, not just at the point the parameter or local is defined, but with every use of them. That the difference is largely hidden makes them all the more different, as every operation upon them differs in effect.

    If we had a lower level language that had nothing but local variables, objects on some sort of non-local heap, and pointers to both of those, then local would be of type string* and strParam of type string**. This would be how we would do a similar sort of operation in C, and how we could do so in C++ though it also has reference types (though with C++ that a type is a reference type is more clearly part of its type definition, and they have further uses and refinements). C# hides almost all of this from us in its syntax. It’s always debatable how beneficial any hiding of details is, but in this case there isn’t much in the way of anything useful being hidden, so it’s one that one would be hard-pressed to criticise.

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

Sidebar

Related Questions

I understand the difference between a Mock and a Stub. But different types of
Ok, I hope this question makes some sense but what is the difference between
I would like to understand the difference between the Boolean and boolean types in
I understand the difference between String and StringBuilder ( StringBuilder being mutable) but is
I am trying to understand the difference between this: if (isset($_POST['Submit'])) { //do something
I thought that the correct type to use to store the difference between pointers
I would like to understand the key difference between parametric polymorphism such as polymorphism
Is there is a difference between size_t and container::size_type ? What I understand is
I am trying to understand difference between those two and really need a explanatory
I understand the difference between a process and a thread. And I know the

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.