string or String

string is an alias in C# for System.String.
So technically there is no difference (it’s like int and System.Int32).

Best practice:

  • Use string any time you’re referring to an object.
  • Use String if you need to refer specifically to the class.

Multi Line Strings

Use the ‘@’ character before the string to create a verbatim string literal:

	String sTemp = @"This
						string is on
						multiple lines";

Notes:

You can have the string be on multiple lines
You don’t need to escape characters other than ” (which you do by using “” 2 x double quotes), so no need for ” C:\\some_directory”
You can’t have comments within it

Convert Value To String

	int Value;
	Value = 100;
	mytextbox.text = Value.ToString();
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *