h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Compare Two ArrayList with DateTime

 private static ArrayList list1 = new ArrayList(new DateTime[] { Convert.ToDateTime("2010-12-01"), Convert.ToDateTime("2010-12-11"), Convert.ToDateTime("2010-12-21") });
        private static  ArrayList list2 = new ArrayList(new DateTime[] { Convert.ToDateTime("2010-12-01"), Convert.ToDateTime("2010-12-15") });
        private static int CountofList1 = list1.Count;
        private static int CountofList2 = list2.Count;
        private static void CompareDatewithArrayList(string Comp)
        {
            switch (Comp)
            {
                case "1":            
                    if (CountofList1 > CountofList2)
                    {
                        foreach (DateTime str in list1)
                        {
                            if (!list2.Contains(str))
                            {
                                MessageBox.Show(Convert.ToString(str));
                            }
                        }
                    }
                    else if (CountofList1 == CountofList2)
                    {
                        foreach (DateTime str in list1)
                        {
                            if (!list2.Contains(str))
                            {
                                MessageBox.Show(Convert.ToString(str));
                            }
                        }
                    }
                    else
                    {
                        foreach (DateTime str in list1)
                        {
                            if (!list2.Contains(str))
                            {
                                MessageBox.Show(Convert.ToString(str));
                            }
                        }
                    }
                    break;
                case "2":
                    if (CountofList1 > CountofList2)
                    {
                        foreach (DateTime str in list2)
                        {
                            if (!list1.Contains(str))
                            {
                                MessageBox.Show(Convert.ToString(str));
                            }
                        }
                    }
                    else if (CountofList1 == CountofList2)
                    {
                        foreach (DateTime str in list2)
                        {
                            if (!list1.Contains(str))
                            {
                                MessageBox.Show(Convert.ToString(str));
                            }
                        }
                    }
                    else
                    {
                        foreach (DateTime str in list2)
                        {
                            if (!list1.Contains(str))
                            {
                                MessageBox.Show(Convert.ToString(str));
                            }
                        }
                    }
                    break;
            }
                    }