METHOD
Convert.ToInt32(double)
Converts a double to int using nearest integer rounding with ties to even. Out-of-range values fail rather than represent an arbitrary integer.
Formal Syntax & Structure
csharp syntaxcsharp
System.Convert.ToInt32(value)Working Example
Example Snippetcsharp
int n = System.Convert.ToInt32(3.5); // 4