using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace yufademo
{
class Program
{
delegate void getstring(string name);//定义委托
static void Main(string[] args)
{
getstring g = new getstring(M2);//委托关联方法
g("song");//用委托的形式来执行方法
Console.Read();
}
static void M2(string s1)//定义一个方法
{
Console.WriteLine(s1);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace yufademo
{
class Program
{
delegate void getstring(string name);//定义委托
static void Main(string[] args)
{
getstring g = new getstring(M2);//委托关联方法
g("song");//用委托的形式来执行方法
Console.Read();
}
static void M2(string s1)//定义一个方法
{
Console.WriteLine(s1);
}
}
}