Game Development Reference
In-Depth Information
Action myDelegate)
{
//Audits that work was done for which manager
WorkCompletedfor.Add(ManagerName);
//Begin work
myDelegate();
}
}
public class Manager
{
private Worker myWorker = new Worker();
public void PeiceOfWork1()
{
//A piece of very long tedious work
}
public void PeiceOfWork2()
{
//You guessed it, yet more tedious work
}
public void DoWork()
{
//Send worker to do job 1
myWorker.DoSomething("Manager1",PeiceOfWork1);
//Send worker to do job 2
myWorker.DoSomething("Manager1", PeiceOfWork2);
}
}
}
Alternatively, you could just express it using the C# lamdas, which simply means you
don't need to declare separate functions as follows:
Search WWH ::




Custom Search