Data Type Conversion. Type conversion is used when we want to assign the value of one data type to another data type. There are two types of conversion in C#. 1) Automatic Type Conversion / Implicit Type Conversion. 2) Explicit Type Conversion.

1) If the data types are of the same type (e.g. numeric) then the C# compiler does automatic type conversion. OR when we assign a smaller data type value to bigger data type value C# does automatic type conversion. In C# numeric data types are compatible with each other so in these data type automatic conversion is possible, but when we try to assign a numeric data type to a string type then it is a compile-time error.

Type Conversion & Casting

Type Conversion & Casting Type conversion is used when we want to assign the value of one data type to another data type. There are two types of conversion in…

Continue Reading Type Conversion & Casting