(Builder) , . # 3.5+ , , LINQ .
public BaseControl
{
public void RenderControl(HTMLWriter writer) {}
}
public TextBox : BaseControl
{
public string Text { get;set; }
}
public static T TabIndex<T>(this T control, int index) where T : BaseControl {}
, , TabIndex , .
BaseControl control1 = new BaseControl();
control1.TabIndex(1);
TextBox control2 = new TextBox()
{
Text = "test"
};
control2.TabIndex(2);
, BaseControl. , . , .
, , , .
var pmLogOnName = Html.CreatePopUpMenu("pmLogOnName")
.AddMenuItem("mLogOnName-RememberMe", "Remember UserName", isCheckBox: true, isSelected: true);
Html.CreateTextBox("txtLogOnName", 1)
.BindData(Model, x => x.LogOnName, "showError")
.WaterMark(LogOnView.LogOnName)
.BindMenu(pmLogOnName)