キーワードDropDownList
をスローするための拡張メソッドがあります。拡張メソッドを使用した例をたくさん見てきたので、理由はよくわかりません。Extension method can only be declared in non-generic, non-nested static classes
this
DropDownList
public static class DropDownListExtensions {
public static void populateDropDownList(this DropDownList source, Action delegateAction) {
source.DataValueField = "Key";
source.DataTextField = "Value";
source.DataSource = delegateAction;
source.DataBind();
}
}