码迷,mamicode.com
首页 > 其他好文 > 详细

Object.ReferenceEquals

时间:2017-04-17 09:21:57      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:char   new   lin   line   als   arp   logs   stat   console   

    class Program
    {
        static void Main(string[] args)
        {
            int i = 2,j = 2;
            bool a = Object.Equals(i, j);
            bool b = Object.ReferenceEquals(i, j);
            Console.WriteLine("{0},{1},{2}", a, b,i.Equals(j));
            char[] hello = { ‘h‘,‘e‘,‘l‘,‘l‘,‘o‘};
            string x = "hello", y = new String(hello);
            a = Object.Equals(x, y);
            b = Object.ReferenceEquals(x, y);
            Console.WriteLine("{0},{1},{2}", a, b, x.Equals(y));
            /*
            True,False,True
            True,False,True
            请按任意键继续. . . 
             */
        }
    }

 

Object.ReferenceEquals

标签:char   new   lin   line   als   arp   logs   stat   console   

原文地址:http://www.cnblogs.com/sky20080101/p/6721259.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!