using System;
using System.Threading;
public delegate string AdviseDelegate(int score);
public class Student
{
private int score;
public void SetScore(int value)
{
if (value > 100 || value < 0)
{
Console.Out.WriteLine("分数不对");
}
else
{
score = value;
if (AdviseDelegateInstance!= null)
{
AdviseDelegateInstance.BeginInvoke(score, new System.AsyncCallback(CallBackMethod),"idior");
}
}
}
private void CallBackMethod(IAsyncResult asyncResult)
{ string result = AdviseDelegateInstance.EndInvoke(asyncResult);
string stateObj=(string)asyncResult.AsyncState;
Console.Out.WriteLine("学生{0}收到老师返回的结果/t" + result,stateObj);
}