1. 程式人生 > >C# 裝箱

C# 裝箱

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 裝箱
            int i = 3;
            object io = i;
            Console.WriteLine(
"i:{0},io:{1}", i, io.ToString()); // 拆箱 int j = (int)io; Console.WriteLine("這是j=" + j); } } }

 

具體可看:https://www.cnblogs.com/dabiaoge/p/4112581.html

這裡不抄錄