19
1
using System;
2
3
namespace DatatypeConversion
4
{
5
public class Program
6
{
7
public static void Main(string[] args)
8
{
9
int myInt = 100;
10
double myDouble = 2.25;
11
bool myBool = true;
12
13
Console.WriteLine(Convert.ToString(myInt)); // Convert int to string
14
Console.WriteLine(Convert.ToDouble(myInt)); // Convert int to double
15
Console.WriteLine(Convert.ToInt32(myDouble)); // Convert double to int
16
Console.WriteLine(Convert.ToString(myBool)); // Convert bool to string
17
}
18
}
19
}
Cached Result
100
100
2
True
100
2
True