c#運算符使用,以及裝箱拆箱

 

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

namespace 運算符
{
    class Program
    {
        static void Main(string[] args)
        {
            Single a = 100.1F;
            Single b = 200.2F;
            bool c = a == b;
            Console.WriteLine(c);
            bool d = a < b;
            Console.WriteLine(d);
            Console.ReadLine();

        }
    }
}

C#的運算符。

 

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

namespace 裝箱與拆箱
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 2009;
            object a = i;//裝箱
            Console.WriteLine(a);

            int j = (int)a;//拆箱
            Console.WriteLine(j);
            Console.ReadLine();
        }
    }
}
c#裝箱與拆箱

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章