Program No: 1
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public static void FindMatches(IList<string>iList,object[] ob)
{
Console.WriteLine(“Match array is:”);
foreach(object o in ob)
{
Console.WriteLine(“{0}”,o.ToString());
}
foreach(object o in ob)
{ if(iList.Contains(o.ToString()))
Console.WriteLine(“\niList contains {0} at index{1}”,o,iList.IndexOf(o.ToString()));
}
}
static void Main(string[] args)
{
string[] strings ={ “one”, “two”, “four”, “eight” };
Console.WriteLine(“Strings array values:\n”);
foreach(String s in strings)
{
Console.WriteLine(“{0}”,s);
}
Console.WriteLine(“\n”);
FindMatches(strings,new String[]{“zero”,”one”,”five”,”eight”});
Console.ReadKey();
}
}
}
Program No:2
using System;
using System.Collections;
public class ArrayList1
{
public static void Main()
{
ArrayList MyAL=new ArrayList();
MyAL.Add(“hello”);
MyAL.Add(“world”);
MyAL.Add(“!”);
Console.WriteLine(“MY ARRRAY LIST”);
Console.WriteLine(“count {0}”,MyAL.Count);
Console.WriteLine(“values”);
printValues(MyAL);
}
public static void printValues(IList MyList)
{
foreach(Object o in MyList)
Console.WriteLine(“{0}”,o);
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public static void FindMatches(IList<string>iList,object[] ob)
{
Console.WriteLine(“Match array is:”);
foreach(object o in ob)
{
Console.WriteLine(“{0}”,o.ToString());
}
foreach(object o in ob)
{ if(iList.Contains(o.ToString()))
Console.WriteLine(“\niList contains {0} at index{1}”,o,iList.IndexOf(o.ToString()));
}
}
static void Main(string[] args)
{
string[] strings ={ “one”, “two”, “four”, “eight” };
Console.WriteLine(“Strings array values:\n”);
foreach(String s in strings)
{
Console.WriteLine(“{0}”,s);
}
Console.WriteLine(“\n”);
FindMatches(strings,new String[]{“zero”,”one”,”five”,”eight”});
Console.ReadKey();
}
}
}
Program No:2
using System;
using System.Collections;
public class ArrayList1
{
public static void Main()
{
ArrayList MyAL=new ArrayList();
MyAL.Add(“hello”);
MyAL.Add(“world”);
MyAL.Add(“!”);
Console.WriteLine(“MY ARRRAY LIST”);
Console.WriteLine(“count {0}”,MyAL.Count);
Console.WriteLine(“values”);
printValues(MyAL);
}
public static void printValues(IList MyList)
{
foreach(Object o in MyList)
Console.WriteLine(“{0}”,o);
}
}