我有课
public class CLASS_K
{
public static List<AA> simpleList = new List<AA>()
{
new AA(){NNN = "o1", NNN2 = "o1a"},
new AA(){NNN = "o2", NNN2 = "o2a"}
};
public class AA
{
public string NNN { get; set; }
public string NNN2 { get; set; }
}
}
我为标签设置绑定:
label1.DataBindings.Add("text", CLASS_K.simpleList[1], "NNN");
如何将 dataSource 从标签转换为 AA 类?
我的错误想法:
BindingSource binding = (BindingSource)label1.DataBindings[0].DataSource;
CLASS_K.AA b = (CLASS_K.AA) binding.DataSource;