Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to convert int type into string type in C#
How to convert int type into string type in C#
Int to string

Use Convert.toString () as follows.

For example:

int a = 10;

string sa = convert . tostring(a);

The result of sa is "10".

Extension:

String to integer

If you are sure that a string is a character that can be converted into a number, you can use int. Parse(string s s), which returns the converted int value;

If you are not sure whether a string can be converted into a number, you can use int. Try parse (strings, out int result), which returns a bool value, indicating whether the conversion operation is successful or not. The parameter result is a variable that stores the conversion result.

References:

Baidu Encyclopedia forced conversion