我最近发现了C#扩展方法,并写了这一个:C#:这是一个ASP.NET项目的合理扩展方法吗?
/// <summary>
/// Short-hand for setting the data source and binding it.
/// </summary>
/// <param name="me">The control to set and bind the data source of.</param>
/// <param name="dataSource">The data source.</param>
public static void BindTo(this DataBoundControl me, IEnumerable dataSource)
{
me.DataSource = dataSource;
me.DataBind();
}
你们有什么觉得?这是在专业ASP.NET项目中使用的合理扩展方法吗?
对我很好。 – 2010-03-09 08:55:42
就像你说的这个参数'我':-) – Steven 2010-03-09 09:33:04