static void Main(string[] args) { Random random = new Random(); dlg mydlg = (x, y, z) => { return((x + y + z) / 3); }; Console.WriteLine("Среднее арифметическое: " + mydlg(random.Next(), random.Next(), random.Next())); Console.ReadKey(); }
private void status_Load(object sender, EventArgs e) { progressBar1.Value = 0; progressBar1.Minimum = 0; progressBar1.Maximum = 567777; progressBar1.Step = 1; Worker.Instance.UpdateCounter += Instance_UpdateCounter; dlgFunc = Instance_UpdateCounter; }
public static int Initialize(dlg funcDelegate) { string resultValue = null; var result = new returnString((s) => { resultValue = s; return(120); }); Console.WriteLine(funcDelegate(result)); Console.WriteLine(resultValue); return(150); }
public void RunDelegateMethod() { dlg dlgObj = new dlg(DLG); dlgObj(100); }