How to convert int to string without using Convert.ToString() Method in C#.NET?


Convert.ToString() method is used to convert integer to string.

There are many other way to convert integer to sting  as mention below.


ToString(): ToString() method is present in System namespace. It is used to convert integer to string.

//integer x
int x = 100;

//convert int to string using tostring() method
string s1 = x.ToString();

//Output 100

String.Format(): It is used to convert object to string based on format specified.

Int value x is converted to string using String.Format function in below example.


//integer x
int x = 100;

//convert int to string using string.format
string s2 = string.Format("{0}",x);

//Output 100

If you want to know more information about String.Format then refer below link.



String is immutable, means string cannot be changed hence stringbuilder is used for string modification.


Here I created object of StringBuilder and appended the int value x then converted builder object to string.

//integer x
int x = 100;

//convert int to string using string builder
StringBuilder builder = new StringBuilder();
string s3 = builder.Append(x).ToString();

//Output 100


Append String:

If we append string value to int value then int value will be converted to string.

//integer x
int x = 100;

//convert to string by adding to another string
string s4 = "" + x;

//Output 100


Please provide your feedback and comments.

Happy coding Smile

Leave a comment

Share via
Copy link
Powered by Social Snap