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;
}
}
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;
}
}