Convert Class
The Convert class provides static methods for type conversion.
string s = "123";int i = Convert.ToInt32(s);double d = Convert.ToDouble(s);Console.WriteLine($"int: {i}, double: {d}");Run the Application
Section titled “Run the Application”dotnet runResult
Section titled “Result”int: 123, double: 123