object与string

来源:互联网 发布:linux locale 设置 编辑:程序博客网 时间:2024/05/22 10:24

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class MyClass
{
    public int i = 100;
}

namespace object1
{
    class Test
    {
        static void Main(string[] args)
        {
            object o;
            o = 100;
            Console.WriteLine(o);
            Console.WriteLine(o.GetType());
            o = new MyClass();
            MyClass myobj;
            myobj = (MyClass)o;
            Console.WriteLine(myobj.i);

            string a = "/u0068ello ";
            string b = "world";
            char chr="test"[2];//chr=s
            Console.WriteLine(a + b);
            Console.WriteLine(a + b == "hello world");
            Console.WriteLine("这个字符为:{0}.", chr);
            Console.ReadLine();
        }
    }
}

原创粉丝点击