static void Main(string[] args) { //Ask for input Console.WriteLine("Enter a number(x): "); String xStr = Console.ReadLine(); int x = Convert.ToInt32(xStr); Console.WriteLine("Enter a second number(y):"); String yStr = Console.ReadLine(); int y = Convert.ToInt32(yStr); //Create a DelegateInt instance to pass the AddFunction DelegateInt del = AddFunction; //Call the method that passes a delegate, referencing the addfunction method AddCallerMethod(x, y, del); //Ask for more input Console.WriteLine("\n\nNow give me a sentence."); string sentenceOne = Console.ReadLine(); Console.WriteLine("And a second sentence."); string sentenceTwo = Console.ReadLine(); //Create DelegateString instance DelegateString del2 = ConcatenateFunction; ConcatenateCallerMethod(sentenceOne, sentenceTwo, del2); Console.ReadLine(); }
public static int Test0() { Test t = new Test(); DelegateInt delegateInt = t.Identity; return(delegateInt(10)); }
public Converter(MainForm f, int wid, int hei, byte mi, string inp, string outp, string binp, byte tsk_mapstatics, byte tsk_season, bool tsk_uop, bool tsk_dds) { form = f; width = wid; height = hei; mapIndex = mi; inPath = inp; outPath = outp; binPath = binp; tileMatrix = new TileMatrix(inPath, mapIndex, mapIndex, width, height); task_mapstatics = tsk_mapstatics; task_season = tsk_season; task_uop = tsk_uop; task_dds = tsk_dds; CDAppendToLog = new DelegateString(form.AppendToLog); CDItemsState = new DelegateBool(form.SetItemsState); CDProgressBarSetMarquee = new DelegateBool(form.ProgressbarSetMarquee); CDProgressBarIncrease = new DelegateVoid(form.ProgressbarIncrease); CDProgressBarSetMax = new DelegateInt(form.ProgressbarSetMax); CDProgressBarSetVal = new DelegateInt(form.ProgressbarSetVal); CDSuccess = new DelegateVoid(form.Success); Log("Loading hues.mul into memory... ", true); Hues.Init(); Log("Done!\n", true); if (task_season != 0) { LoadLTDictionary(); } if (tsk_dds) { loadRadarcol(); bmp = new Bitmap(width, height, PixelFormat.Format16bppRgb555); Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height); bmpData = bmp.LockBits(rect, ImageLockMode.WriteOnly, bmp.PixelFormat); unsafe { bmpPtr = (byte *)bmpData.Scan0.ToPointer(); } } }
public static void Foo(DelegateInt input) { }
//Create a caller method for the add function public static void AddCallerMethod(int a, int b, DelegateInt delInt) { Console.WriteLine("\n\nThe sum of the numbers is equal to " + delInt(a, b) + ".\n\n"); }
public static void Foo (DelegateInt input) { }