Convert Float to Int in C# | Delft Stack
www.delftstack.com › howto › csharpMar 10, 2021 · Converted float 10.8 to int 11 We converted the float variable f to the integer variable i with the Math.Round() function in C#. The (int) is used to cast the double value returned by the Math.Round() function to an integer value. This is the optimal approach for converting a float value to an integer value in C#.
Built-in numeric conversions - C# reference | Microsoft Docs
docs.microsoft.com › en-us › dotnetSep 15, 2021 · The implicit conversions from int, uint, long, ulong, nint, or nuint to float and from long, ulong, nint, or nuint to double may cause a loss of precision, but never a loss of an order of magnitude. The other implicit numeric conversions never lose any information.