两个子窗口向一个主窗口发送信息 主窗口: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Windo…
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace _05委托 { //声明一个委托 public delegate string DelProStr(string str);//既可以有参数,也可以有返回值 class Program { stati…
1.委托简单例子 class eeProgram { // 声明delegate对象 public delegate string CompareDelegate(int a, int b); // public static CompareDelegate ceshi = new CompareDelegate(Program.Compare); // 欲传递的方法,它与CompareDelegate具有相同的参数和返回值类型 public static string Compare(int…
使用delegates委托写插件方法: public delegate int Transformer (int x); public class Util { public static void Transform (int[] values, Transformer t) { for (int i = 0; i < values.Length; i++) values[i] = t(values[i]); } } class Test { static void Main() { int[…
关于IEnumerable和IQueryable的区别,这事还要从泛型委托Func<T>说起.来看一个简单的泛型委托例子: class Program { static void Main(string[] args) { Func<int, bool> f = i => i > 5; Console.WriteLine(f(3)); Console.WriteLine(f(10)); Console.ReadKey(); } } Func<T>是"…