ToString(); function in C#
ToString(); function is used to to get the instance of the String.
Example
using System;
namespace program
{
class Program
{
static void Main(string[] args)
{
string str1 = "Hello";
int x = 100;
string str2 = str1.ToString();
string str3 = x.ToString();
Console.WriteLine(str2);
Console.WriteLine(str3);
Console.ReadKey();
}
}
}
Output
Hello
100
ToString(); function is used to to get the instance of the String.
Example
using System;
namespace program
{
class Program
{
static void Main(string[] args)
{
string str1 = "Hello";
int x = 100;
string str2 = str1.ToString();
string str3 = x.ToString();
Console.WriteLine(str2);
Console.WriteLine(str3);
Console.ReadKey();
}
}
}
Output
Hello
100