我读了一些C#代码,无法理解函数参数中的“this”关键字?有人能告诉我它用于什么吗?谢谢。什么是“这个”用于?
public static class ControlExtensions
{
public static void InvokeIfNeeded(this Control ctl,
Action doit)
{
if (ctl.InvokeRequired)
ctl.Invoke(doit);
else
doit();
}
public static void InvokeIfNeeded<T>(this Control ctl,
Action<T> doit, T args)
{
if (ctl.InvokeRequired)
ctl.Invoke(doit, args);
else
doit(args);
}
}
感谢您的链接,帮助我更好地理解。 –