C#中简单的拆箱操作演示代码
将object转换成int类型
附件中带有源代码和详细可执行文件供参考
using System; class ConversionSample { static void Main() { Object obj = 123; int num1 = (int)obj; Console.WriteLine(num1.ToString()); Console.WriteLine(obj.ToString()); } }
附件:源代码下载
C#中简单的拆箱操作演示代码
将object转换成int类型
附件中带有源代码和详细可执行文件供参考
using System; class ConversionSample { static void Main() { Object obj = 123; int num1 = (int)obj; Console.WriteLine(num1.ToString()); Console.WriteLine(obj.ToString()); } }
附件:源代码下载