Solved

Difference between String.Empty and ""?

Posted on 2014-12-01
2
70 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
[X]
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
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Title # Comments Views Activity
Vb.net threads keep increasing 2 59
Filtering a datagrid view 8 43
Create a Dropdown list with sub group 10 43
VB.net Is there code behind PowerPivot 2 70
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 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