新手求助 网上刚看到的C#的四个基本技巧
public class KeyboardProcessor {
private OnGetLine theFunc = null; //OnGetLine 这个是什么类型的???
public OnGetLine OnGetLineCallback {
get {
return theFunc;
}
set {
theFunc = value;
}
}
public void Run (){
// Read input.
// If there is any listeners, publish:
string s;
do {
s = Console.ReadLine ();
if (s.Length == 0)
break;
if (theFunc != null){
System.Delegate [] funcs =theFunc.GetInvocationList();
foreach (OnGetLine f in funcs) {
try {
f (s);
} catch (Exception e) {
Console.WriteLine
("Caught Exception: ", e.Message);
}
}
}
} while (true);