static void Main(string[] args) { delegateParam myDelegate = new delegateParam(methodForDelegate); methodService(myDelegate, "Hami"); Console.ReadKey(); }
static void Main(string[] args) { delegateParam sonDelgate = new delegateParam(methodeAdelegateProduite); methodeService(sonDelgate, "helloooooooo"); Console.ReadKey(); }
public static byte[] InvokeDelegate(object[] args) { byte[] address = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6 }; byte[] contractAddr = (byte[])args[1]; byte[] from = (byte[])args[2]; byte[] to = (byte[])args[3]; byte[] role = (byte[])args[4]; int period = (int)args[5]; int level = (int)args[6]; int keyNo = (int)args[7]; object[] param = new object[1]; param[0] = new delegateParam { ContractAddr = contractAddr, From = from, To = to, Role = role, Period = period, Level = level, KeyNo = keyNo }; return(Native.Invoke(0, address, "delegate", param)); }
private static void methodService(delegateParam p, string txt) { Console.WriteLine(txt + " The result is: {0:f2}", p(10.0, 4)); }