日期:2014-05-18  浏览次数:20859 次

C#中this用法
查看mvc的源代码,看到这种写法
C# code

  public static string RouteLink(this AjaxHelper ajaxHelper, string linkText, object routeValues, AjaxOptions ajaxOptions) {
            return RouteLink(ajaxHelper, linkText, null /* routeName */, new RouteValueDictionary(routeValues), ajaxOptions,
                             new Dictionary<string, object>());
        }


我想知道参数中的this为什么那么写?
谢谢!!!

------解决方案--------------------
这是扩展方法。

你可以查阅MSDN,输入扩展方法,或者Extend Method。
------解决方案--------------------
http://msdn.microsoft.com/zh-cn/library/bb383977.aspx