sir
please sir send me web services and oops concept Notes for more learning
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Praveen NPosted Dec 23, 2013, 12:40 AM
There is no difference. They are equivalent.
There used to be a difference (before .NET 2.0), in that
""created a new, empty string object whileString.Emptywas a reference to a static instance of an emtpy string. This difference was removed .NET 2.0.string.empty handles memory efficently than string x="";
"" actually creates an object but string.empty does not.
Also, it is a best practise to avoid hardcoding like "";
please see the following link
http://msdn.microsoft.com/en-us/library/system.string.empty%28v=VS.80%29.aspx
String.Empty because it looks nice to me and is more readable. Also, a problem with "" is that sometimes by mistake it is written as " " which is not an empty string. However, it is just programmer's choice whether to use "" or String.Empty while the two are identical to each other.Thanks & Regards,
Praveen Nelge
Jignesh TrivediPosted Dec 23, 2013, 12:39 AM
yes...
both are same.
the value of Strin.Emptyfield is the zero length string "".
VulpesPosted Dec 22, 2013, 4:46 AM
"" is a string literal representing a zero length string and String.Empty is a static read-only field of the String class which returns a zero length string.
I'll leave others to send you the notes.