标签:task eric otn generic lin lang stat oid mes
使用Convert可以进行类型转换。
如:可以将string类型的值转换为int类型、double类型的值。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo {
class Program {
static void Main(string[] args) {
string s= "123";
double d=Convert.ToDouble(s);
Int32 i = Convert.ToInt32(s);
Console.WriteLine("d:{0},i:{1}",d,i);
Console.ReadKey();
}
}
}
运行:
具体方法可以参考官方文档
标签:task eric otn generic lin lang stat oid mes
原文地址:https://www.cnblogs.com/lz32158/p/12812191.html