Solved

Difference between String.Empty and ""?

Posted on 2014-12-01
2
69 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

679 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