I have used many of the Convert.To..... functions for conversion , but I didn't understand one thing that for every datatype they have provide a Convert.To function but not for float datatype, in order to convert to float you need to use Convert.ToSingle() , why is this so ?
Single is the CTS (Common Type System for .NET) type, float is the C# shorthand for it.
Int32 CTS -> int C#
String CTS -> string C#
Double CTS -> double C#
Single CTS -> float C#
Int16 CTS -> short C#
Int64 CTS -> long C#
etc.
The Convert methods are .NET methods and therefore use the CTS names and not the C# shorthands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With