In this article We will Discuss about What is the difference between string.Format and String.Format.
Well, absolutely there is no difference between string.Format and String.Format.
Even if we can say that both are equal but there is one Small difference exist i.e if we use String.Format then Compulsory we need to include using System; Namespace otherwise it will Show you error.
For string.Format it is not mandatory to include using System; Namespace.
Example:-
-------------
string query = string.Format("Select * from [{0}]", SheetName); //No Error
string query1 = String.Format("Select * from [{0}]", SheetName); // Will Show Error if using System; Namespace not included.
Note:- Such type of Questions ask by Interviewer to make you Confusion.
Well, absolutely there is no difference between string.Format and String.Format.
Even if we can say that both are equal but there is one Small difference exist i.e if we use String.Format then Compulsory we need to include using System; Namespace otherwise it will Show you error.
For string.Format it is not mandatory to include using System; Namespace.
Example:-
-------------
string query = string.Format("Select * from [{0}]", SheetName); //No Error
string query1 = String.Format("Select * from [{0}]", SheetName); // Will Show Error if using System; Namespace not included.
Note:- Such type of Questions ask by Interviewer to make you Confusion.
0 comments:
Post a Comment