I have written a class called QueueManager:
class QueueManager
{
Queue functionsQueue;
public bool IsEmpty
{
get
{
if (functionsQueue.Count == 0)
return true;
else
return false;
}
}
public QueueManager()
{
functionsQueue = new Queue();
}
public bool Contains(Action action)
{
if (functionsQueue.Contains(action))
return true;
else
return false;
}
public Action Pop()
{
return functionsQueue.Dequeue() as Action;
}
public void Add(Action function)
{
functionsQueue.Enqueue(function);
}
public void Add(Func<CacheObject,Boolean> function)
{
functionsQueue.Enqueue(function);
}
and when I create an instance of this class and call Add method it works fine for functions with no arguments, for example: functionQueue.Add(Method); , but when calling on methods that have an argument and return value(in my case ClassType as argument, and Boolean as return value), for example functionQueue.Add(Method2(classObject)); it does not compile, what am I missing?