Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Saturday, October 11, 2014

In Asp.net Difference between ""(empty string) and String.Empty

What is the difference between String.Empty and "" (empty string):



In Asp.net created String is an object of String Class.

String str=”” Creates an object 
And
String.Empty creates no object.

So it is more efficient to use String.Empty.

Source of information
.Length == 0 is the fastest option,
But .Empty makes for slightly cleaner code.
So "" is pretty equivalent to .Empty, but still not as fast as .Length == 0.
string.Empty doesn't create an object while "" creates a string object.

Difference between Empty String and Null value string:

Null is an absence of a value. An empty string is a value, but is just empty.
Null is special to a database.

The difference between '1' and "1" for in a database query is that the SQL syntax supports '1' for SQL queries, but doesn't use "1".


Asp.net related Other Post :




No comments:

Post a Comment