Skip to content

Type Conversion

Type conversion changes a value from one type to another.

int i = 100;
double d = i; // implicit
int j = (int)d; // explicit
Console.WriteLine($"i={i}, d={d}, j={j}");
Terminal window
dotnet run
Terminal window
i=100, d=100, j=100