The following example works, but how can I change it so that instead of executing the anonymous method, it executes my existing callback method OnCreateOfferComplete()
?
using System;
namespace TestCallBack89393
{
class Program
{
static void Main(string[] args)
{
OfferManager offerManager = new OfferManager();
offerManager.CreateOffer("test", () => Console.WriteLine("finished."));
//offerManager.CreateOffer("test", OnCreateOfferComplete );
//above line gives error: an object reference is required
//for a non-static field...
Console.ReadLine();
}
private void OnCreateOfferComplete()
{
Console.WriteLine("finished");
}
}
public class OfferManager
{
public void CreateOffer(string idCode, Action onComplete)
{
if (onComplete != null)
onComplete();
}
}
}