Solved

Difference between String.Empty and ""?

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now