IButtonControl 是个interface, 怎么会有property的东西要implement 呢?
在看Programming ASP.NET O‘relly 2005的那本,在6.3.3最后一段说:
PostBackUrl is a property of all controls that implement the IButtonControl interface. This includes the Button, ImageButton, and LinkButton ASP.NET server controls.
可IButtonControl 是个interface, 怎么会有property的东西要implement呢?
interface 不是只包含merthod 声明的类啊?
------解决方案--------------------在.NET中,属性在某种程度上讲,是加了糖的方法,参考
http://blogs.msdn.com/kaevans/archive/2004/05/02/124778.aspx
using System;
namespace System.Web.UI.WebControls
{
public interface IButtonControl
{
bool CausesValidation { get; set; }
string CommandArgument { get; set; }
string CommandName { get; set; }
string PostBackUrl { get; set; }
string Text { get; set; }
string ValidationGroup { get; set; }
event EventHandler Click;
event CommandEventHandler Command;
}
}