c#中int.parse
Int32.Parse()方法 (Int32.Parse() Method)
This method is used to convert a string into an integer.
此方法用于将字符串转换为整数。
Syntax:
句法:
int int.Parse(string str);
Parameter(s):
参数:
string str – represents a string object to be parsed.
string str –表示要分析的字符串对象。
Return value:
返回值:
int – it returns an integer value.
int –返回整数值。
C#中的Int32.Parse()方法示例 (Int32.Parse() Method Example in C#)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int X = 0;
Console.Write("Enter value of X: ");
X = int.Parse(Console.ReadLine());
Console.WriteLine("Value of X is : "+ X);
}
}
}
Output
输出量
Enter value of X: 12345
Value of X is : 12345
翻译自: https://www.includehelp.com/dot-net/int32-parse-method-with-example-in-csharp.aspx
c#中int.parse