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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:09:30+00:00 2026-05-26T10:09:30+00:00

I just cannot get the point: If ‘\0’ is an empty char and if

  • 0

I just cannot get the point: If ‘\0’ is an empty char and if a string is a kind of array of chars why this happens?

char value = '\0';
bool isEmpty = value.ToString() == string.Empty; // This returns FALSE because 
                                                 // '\0'.ToString() returns "\0" 
                                                 // where I expect it to be 
                                                 // string.empty
  • 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-26T10:09:30+00:00Added an answer on May 26, 2026 at 10:09 am

    There’s no such thing as an “empty char”, so your assumption in the first sentence is incorrect. A string with a single character (U+0000) is not the same as an empty string – for a start, the length of the first string is 1, not 0.

    Calling ToString() on a char will always return a string of length 1, containing just that character. That’s the only thing that it makes sense to do, IMO. I don’t know why you would expect anything else.

    While U+0000 is often used as a terminating character, it’s not the same as the character “not existing”. The string “Foo\0Bar” is not the same as “FooBar”, and shouldn’t be treated the same.

    In short: it’s your expectations which are incorrect, not .NET 🙂

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

Sidebar

Related Questions

I just cannot get this to work, would appreciate if someone can help. So
So obviously I am doing something wrong, but I just cannot seem to get
I cannot get the jQuery slideDown function to work on <table> elements. They just
I just cannot figure this out, it looks really simple but I'm relatively new
I actually asked this question before, but I cannot get my account details back,
I just cannot imaginate a way to do a call to a function with
If it's an int, I know it will be faster, just cannot understand the
I just want to understand why I cannot create a protected enum on C#?
I have just heard that the iphone cannot do double natively thereby making them
I cannot find where the sqlcmd is? i just want the prompt. please help!

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.