当前位置: 代码迷 >> 综合 >> 字符串转化为整型2
  详细解决方案

字符串转化为整型2

热度:57   发布时间:2024-01-17 03:34:41.0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
/**
* 字符串转化为整型2
*/
static void Main(string[] args)
{
int i;
if (int.TryParse("12", out i))
{
Console.WriteLine(i);
}
else
{
Console.WriteLine("字符串转为为整型错误.");
}
Console.ReadKey();
}
}
}


  相关解决方案