Reprint: http://www.cnblogs.com/xshy3412/archive/2007/08/29/874362.html
1,int turns into a string
With ToString
or convert.tostring () as follows
For example:
int varint = 1;
String varstring = Convert.ToString (varint);
String varString2 = Varint.tostring ();
2,string Turn int
If you determine that a character in a string can be converted to a number, you can use Int. Parse (string s), which returns the converted int value;
If you cannot determine whether a string can be converted to a number, you can use Int. TryParse (string s, out int result), which returns a bool value indicating whether the conversion operation was successful, and the parameter result is a variable that holds the result of the conversion.
For example:
String str = string. Empty;
str = "123";
int Result=int. Parse (str);
String str = string. Empty;
str = "XYZ";
int result;
Int. TryParse (str, out result);
C#,int turn into string,string and turn into int