Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Difference between String.Empty and ""?

Posted on 2014-12-01
2
68 Views
Last Modified: 2014-12-01
When I initialize a String variable...I always assign "" to it, i.e.  strVar1 = ""

Is String.Empty the same as ""? If so, is String.Empty the correct way to initialize a String variable?

Thanks!
0
Comment
Question by:BlakeMcKenna
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40473804
Yes they are exactly the same. Empty quotes could be considered to be a magic string, which you should try to avoid. String.Empty is simply a constant provided by the Framework.
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 40473838
Thanks for the confirmation Kaufmed!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question