0
在嘗試解決here中的雙向數據綁定問題時,我發現以下不會拋出無效成員異常,如果我記得正確,它應該。 MSDN也記錄了這個異常here的存在,但它爲什麼不拋出?DataBinding無效數據成員不拋出的異常
namespace EnumDataBinding
{
public partial class Form1 : Form
{
public Form1()
{
ComboBox box = new ComboBox();
// EXPECT: DataMember not found exception
// RESULT: Exception not thrown!
box.DataBindings.Add("Text", new Entity(), "asdhjgfjhrt");
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
}
public class Entity
{
public string MyProperty { get; set; }
}
}