protected void MakeAutoComplete(ref Control control, IListSource dListSource)
{
MakeAutoComplete(ref control, dListSource, false);
}
protected void MakeAutoComplete(ref Control control, IListSource dListSource, bool isComboBox)
{
var curControl = (isComboBox) ? (control as ComboBox) : (control as TextBox);
// other
}
var curControlVS
の行でエラーが発生しましType of conditional expression cannot be determined because there is no implicit conversion between 'System.Windows.Forms.ComboBox' and 'System.Windows.Forms.TextBox'た。エラーを理解でき、キャストがないことはわかっていますが、そもそもTextBoxそれComboBoxが使用している理由ですvar。だから問題は何ですか?なぜ文句を言うのですか?