I have noticed that in C# there are two different types of string (string and String). What is the difference between them and what are the guidelines for their use?
One thought on “I have noticed that in C# there are two different types of string (string and String). What is the difference between them and what are the guidelines for their use?”
Technically there is no difference, string is an alias for System.String in .net programming. When referring to Objects it is recommended to use string. String is generally recommended when you need to refer specifically to the class.
Examples:
string strPlace = “earthâ€
string strStatement = String.Format(“The {0} is a beautiful planet.â€,strPlace)
Technically there is no difference, string is an alias for System.String in .net programming. When referring to Objects it is recommended to use string. String is generally recommended when you need to refer specifically to the class.
Examples:
string strPlace = “earthâ€
string strStatement = String.Format(“The {0} is a beautiful planet.â€,strPlace)