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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:55:35+00:00 2026-05-11T17:55:35+00:00

C#: Which uses more memory overhead? A string or a char holding a sequence

  • 0

C#: Which uses more memory overhead? A string or a char holding a sequence of a word?

I know a char is basically an array of each char to make up a word (if more than one char), but which would ultimately cause you more memory overhead like when using a string vs. a char to hold something the length of a word?

  • 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-11T17:55:35+00:00Added an answer on May 11, 2026 at 5:55 pm

    It would depend how many times you used the thing in question. The way .Net does strings is that if you had multiple strings with the same value then that value is only stored in memory once and each string variable points to that value. However each char array used would have its own memory allocation even if the contents of the char array were identical.

    eg

    //.Net Framework allocates memory space for "word" only once, all the three variables refer to this chunk of memory
    String s1, s2, s3;
    s1 = "word";
    s2 = "word";
    s3 = "word";
    
    //.Net Framework allocates memory for each array
    char[] c1 = new char[] { 'w','o','r','d'};
    char[] c2 = new char[] { 'w','o','r','d'};
    char[] c3 = new char[] { 'w','o','r','d'};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • 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 Seriously, you're going to keep having troubles if you continue… May 12, 2026 at 1:07 am
  • Editorial Team
    Editorial Team added an answer Wrong, that will just fill your code with session management… May 12, 2026 at 1:07 am
  • Editorial Team
    Editorial Team added an answer Ah, repeated events - one of the banes of my… May 12, 2026 at 1:07 am

Related Questions

From time to time have I come across manually implemented sort and/or search algorithms,
The Gang of Four's Design Patterns uses a word processor as an example for
I've create a c# application which uses up 150mb of memory (private bytes), mainly
I'm looking for a portable and easy-to-use string library for C/C++, which helps me

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.