• Equals 和==


    class Person
        {
            private string name;
            public string Name
            {
                get { return name; }
                set { name = value; }
            }
            public Person(string name)
            {
                this.name = name;
            }
        }
        class Program
        {
            static void Main(string[] args)
            {
                string a = new string(new char[] { 'h''e''l''l''o' });
                string b = new string(new char[] { 'h''e''l''l''o' });
                Console.WriteLine(a == b);
                Console.WriteLine(a.Equals(b));
                object g = a;
                object h = b;
                Console.WriteLine(g == h);
                Console.WriteLine(g.Equals(h));
     
                Person p1 = new Person("jia");
                Person p2 = new Person("jia");
                Console.WriteLine(p1 == p2);
                Console.WriteLine(p1.Equals(p2));
                Person p3 = new Person("jia");
                Person p4 = p3;
                Console.WriteLine(p3 == p4);
                Console.WriteLine(p3.Equals(p4));
                Console.ReadLine();
            }
        }
    http://zhidao.baidu.com/question/131846375.html
  • 相关阅读:
    记录心得-IntelliJ iDea 创建一个maven管理的的javaweb项目
    记录心得-FastJson分层解析demo示例
    11.05Mybatis注解
    11.03Mybatis标签
    11.04Mybatis resultMap元素
    11.02Mybatis Mapper映射器
    11.02Mybatis SQL执行方式
    10.30Mybatis配置文件及其元素
    10.30Mybatis三要素
    10.29第一个Mybatis程序
  • 原文地址:https://www.cnblogs.com/bingguang/p/3167649.html
Copyright © 2020-2023  润新知