0
인터페이스를 사용하여 두 개의 다른 객체로 콤보 박스를 채우고 싶습니다. 이것이 내가 현재 가지고있는 것입니다. 이 작동하지만 지금은 각 개체에 대한 표시 멤버 및 값 멤버를 갖고 싶습니다, 어떻게 그렇게합니까?두 개의 다른 객체로 콤보 박스 채우기
Controller.cs에서public List<IMusic> Populate()
{
List<IMusic> newList = new List<IMusic>();
foreach(Track t in tr.GetAllTracks()){
newList.Add(t);
}
foreach (Artist a in ar.GetAllArtists())
{
newList.Add(a);
}
return newList;
}
IMusic.cs
interface IMusic
{
}
데이터 소스와 콤보 :
cBMainScreen_Search.DataSource = controller.Populate();
가
으로 GetAllTracks()
GetAllArtists() :
public List<Artist> GetAllArtists()
{
return db.Artist.ToList();
}