I have a static list:
public static List<IMachines>mList =new List<IMachines>();
The list intakes two different types of objects(machines) in it:
IMachines machine = new AC();
IMachines machine = new Generator();
If after adding items to the list, I want to search for a particular machine by its name property then after using the foreach loop for traversal if that item is found in list … how am I supposed to know if the item is of AC type or Generator type?
Use the “is” operator.