示例#1
0
        //[Benchmark]
        //public void TestClass()
        //{
        //    var dictionary = new Dictionary<object, int>();

        //    for (int i = 0; i < N; i++)
        //    {
        //        var boxingClass = MakeBoxingClass(i);
        //        if (!dictionary.ContainsKey(boxingClass))
        //        {
        //            dictionary.Add(boxingClass, i);
        //        }
        //    }
        //}

        //[Benchmark]
        //public void TestStructAndInterface()
        //{
        //    IDictionary<object, int> dictionary = new Dictionary<object, int>();

        //    for (int i = 0; i < N; i++)
        //    {
        //        var boxingStruct = MakeBoxingStruct(i);
        //        if (!dictionary.ContainsKey(boxingStruct))
        //        {
        //            dictionary.Add(boxingStruct, i);
        //        }
        //    }
        //}

        public BoxingStruct MakeBoxingStruct(int id)
        {
            var boxingStruct = new BoxingStruct()
            {
                Id   = id,
                Name = "Test User",
                User = new UserStruct()
                {
                    name        = "Test User",
                    email       = "*****@*****.**",
                    phone       = "8293839283",
                    age         = 11110,
                    createdDate = DateTime.UtcNow,
                    updateDate  = DateTime.UtcNow,
                    password    = "******",
                    profilePic  = "profilePic.jpg"
                },
                //Stats = new StatsStruct()
                //{
                //    posts = 10000,
                //    comments = 12000,
                //    reads = 100000,
                //    likes = -11000,
                //    topPost = "http://topPost",
                //    worstPost = "http://worstPost"
                //}
            };

            return(boxingStruct);
        }
示例#2
0
        //public StatsStruct Stats { get; set; }


        public override bool Equals(object obj)
        {
            if (!(obj is BoxingStruct))
            {
                return(false);
            }

            BoxingStruct mys = (BoxingStruct)obj;

            return(mys.Id == Id);
        }