1. You could call the ToInt32 method to convert an input string to an int:

C# 8.0 and .NET Core 3.0 – Modern Cross-Platform Development: Build applications with C#, .NET Core, Entity Framework Core, ASP.NET Core, and ML.NET using Visual Studio Code, 4th Edition
ASP.NET Core 3 and Angular 9: Full stack web development with .NET Core 3.1 and Angular 9, 3rd Edition
C# in Depth, 4th Edition

int numberVar = Convert.ToInt32(“37”);

2.You could also convert a string to an int through the Parse method of the System.Int32 struct:

int numberVar = Int32.Parse(“-37”);