Tuesday 4 August 2015

String Vs string ?

string is an alias of System.String. string is reserved keyword in c# .net. Int32 Vs int is a similar situation as is BooleanVs bool.  To use string any time refering to an object.

Ex:-
string place = ”world”;

String (System.String) is a class in the base class library. To use String if you need to refer specially to a class.

Ex:-
string strText = String.Format("Helo {0}", place);

So technically there is no difference between string and String.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.