Пример #1
0
        public static void InsertSTUDENTS()
        {
            ISqlMapper mapper = EntityMapper;
            MyClass3   testVo = new MyClass3()
            {
                C_KOR_NAME = "윤호", C_ENG_NAME = "YUNHO", C_AGE = 30
            };

            mapper.Insert("InsertSTUDENTS", testVo);
        }
Пример #2
0
        public static void SelectSTUDENTS()
        {
            ISqlMapper       mapper     = EntityMapper;
            MyClass3         testVo     = new MyClass3();
            IList <MyClass3> resultList = mapper.QueryForList <MyClass3>("SelectSTUDENTS", testVo);

            for (int x = 0; x < resultList.Count; x++)
            {
                Console.WriteLine(resultList[x].C_KOR_NAME + resultList[x].C_ENG_NAME + resultList[x].C_AGE);
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            MyClass m1 = new MyClass();
            MyClass2 m2 = new MyClass2();
            MyClass3 m3 = new MyClass3();

            Console.WriteLine(m1.GetHashCode() + "    " + m1.id);
            Console.WriteLine(m2.GetHashCode() + "    " + m2.id);
            Console.WriteLine(m3.GetHashCode() + "    " + m3.id);

            Console.WriteLine("-----------------------");
            m1 = (MyClass)m1.clone();
            m2 = (MyClass2)m2.clone();
            m3 = (MyClass3)m3.Clone();
            Console.WriteLine("-----------------------");

            Console.WriteLine(m1.GetHashCode() + "    " + m1.id);
            Console.WriteLine(m2.GetHashCode() + "    " + m2.id);
            Console.WriteLine(m3.GetHashCode() + "    " + m3.id);
        }
Пример #4
0
        public object Clone()
        {
            MyClass3 clon = new MyClass3();
            clon.i = this.i;
            clon.str = this.str;

            //clon.id = this.id;          // passive clonning
            clon.id = clon.GetHashCode(); // smart clonning

            return clon;

            #region another way
            MyClass3 clon2 = (MyClass3)this.MemberwiseClone();
            clon2.id = clon2.GetHashCode();
            return clon2;

            //or
            //return this.MemberwiseClone();
            #endregion
        }