Convert.ToSingle () for floating point data Type

I used many Convert.To ..... functions for conversion, but I did not understand that for each data type they provide the Convert.To function, but not for the float data type, to convert to float you need to use Convert.ToSingle ( ), why is this so?

+4
source share
1 answer

Single is the CTS (Common Type System for .NET) type, float is short for C #.

Int32 CTS -> int C# String CTS -> string C# Double CTS -> double C# Single CTS -> float C# Int16 CTS -> short C# Int64 CTS -> long C# 

and etc.

Conversion methods are .NET methods and therefore use CTS names, not abbreviated C #.

+9
source

Source: https://habr.com/ru/post/1305824/


All Articles