namespace Delegate
{
delegate void AutoSkill ( ) ;
class Program
{
static void Main ( string [ ] args)
{
Skill sk = new Skill ( ) ;
AutoSkill apk = new AutoSkill ( Skill5) ;
apk += Skill6;
apk += sk. Skill4;
apk. Invoke ( ) ;
}
public static void Skill5 ( )
{
Console. WriteLine ( "技能动画5" ) ;
}
public static void Skill6 ( )
{
Console. WriteLine ( "技能动画6" ) ;
}
public static void Skill7 ( )
{
Console. WriteLine ( "技能动画7" ) ;
}
public static void Skill8 ( )
{
Console. WriteLine ( "技能动画8" ) ;
}
}
}
using System ;
using System. Collections. Generic ;
using System. Linq ;
using System. Text ;
using System. Threading. Tasks ;
namespace Delegate
{
class Skill
{
public void Skill1 ( )
{
Console. WriteLine ( "技能动画1" ) ;
}
public void Skill2 ( )
{
Console. WriteLine ( "技能动画2" ) ;
}
public void Skill3 ( )
{
Console. WriteLine ( "技能动画3" ) ;
}
public void Skill4 ( )
{
Console. WriteLine ( "技能动画4" ) ;
}
}
}
Skill sk = new Skill ( ) ;
AutoSkill apk = Skill5;
apk += Skill6;
apk += sk. Skill4;
apk ( ) ;