一道书上的题 我想问问!!!1
using System;
namespace DelegateRegisterFinish
{
class Student
{
();//定义委托
public delegate void DelegateRegisterFinish
//通过委托定义事件
public event DelegateRegisterFinish RegisterFinish;
private string _name;
public Student(string name)
{
this._name = name;
}
public void Register()
{
Console.WriteLine( "学生{0}进行注册 ",_name);
if(RegisterFinish !=null)
{//引发事件
RegisterFinish();
}
}
}
class RegisterStudent
{
static void Main()
{
Console.WriteLine( "输入注册学生的姓名: ");
String stuname = Console.ReadLine();
Student s = new Student(stuname);
//订阅Student类的DelegateRegisterFinish事件
s.RegisterFinish +=new
DelegateRegisterFinish.Student.DelegateRegisterFinish(
!!!!!这句什么意思啊 -------- s_RegisterFinish);
}
private static void s_RegisterFinish() <-----—
{ |
&