C# types are not the same! In some cases you have to convert a value's type.
Usually C# functions convert argument's value type automatically. There you don't have to do anything.
Sometimes C# function don't convert value types. Here, you have to do it manually. There are two methods:
- By reassigning the value to a new variable:
int myVar = (int) 1.0;
- By using methods:
string myVar = Convert.ToString(10);Note:
ToInt32for int conversion.
myDBL to int and print it.