Hi
I am trying to create a arraylist of Intefaces so I only need to create each
once and I would like to
be able to identify the specific interface when I loop thru ???
Is there some way to set a Custom Attribute on each Instance of the
Interface???
Thanks
public interface IAnimal
{
bool Print();
}
public class Dog : IAnimal
{
public bool Print()
{
Console.WriteLine("Dog");
return true;
}
}
public class Cat : IAnimal
{
public bool Print()
{
Console.WriteLine("Cat");
return true;
}
}
public class PROGRAM
{
static public void Main()
{
ArrayList myArrList = new ArrayList();
myArrList.Add(new Dog());
myArrList.Add(new Cat());
foreach (IAnimal thing in myArrList)
{
//How to tell What IAminal is???
}
}
}