Callback With Ref Parameter C# with Example
using System; namespace CSharpDelegate { delegate void MyDelegate(ref int value); class CallbackWithRefParameter { static void Main() { MyDelegate callMethod = new MyDelegate(Calculate1); callMethod += Calculate2; int xValue = 5; callMethod(ref xValue); Console.WriteLine("xValue: " + xValue); } public static void Calculate1(ref int val) { val = val * val; } public static void Calculate2(ref int val) { val += 100; } } }