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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:00:14+00:00 2026-06-10T16:00:14+00:00

Is it better to transfer small or large strings by reference in C#? I

  • 0

Is it better to transfer small or large strings by reference in C#? I assumed transferring by value would force the runtime to create a clone of the input string, and thus be slower. Is it recommended for all string functions to transfer values by reference therefore?

  • 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-06-10T16:00:16+00:00Added an answer on June 10, 2026 at 4:00 pm

    I assumed transferring by value would force the runtime to create a clone of the input string, and thus be slower.

    Your assumption is incorrect. String is a reference type – calling a method with a string argument just copies that reference, by value. There’s no cloning involved. It’s a fixed size – 4 or 8 bytes depending on which CLR you’re using.

    (Even if it were a value type, it would have to basically contain a reference to something else – it wouldn’t make sense to have a variable-size value type allocated directly on the stack. How much space would be allocated for the variable? What would happen if you changed the value of the variable to a shorter or longer string?)

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

Sidebar

Related Questions

What is the better way to handle exceptions if I need to transfer them
I have to transfer large files between computers on via unreliable connections using WCF.
im writing a file transfer application to send and receive a large data like
Is it possible to achieve better data transfer rate with multiple parallel TCP connections
I need to create a data transfer object, which I will use for storing
I would like to have a better understanding of how the components of Android's
POCO = Plain Old CLR (or better: Class) Object DTO = Data Transfer Object
I have a file transfer application (large files) and I want to make it
I would like to securely transfer sensitive variables between multiple in PHP. Normally I
I'm guessing bluetooth. What are the transfer speeds? It would have to work on

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.