0

I have a database that stores objects (Profile), two of the objects properties are the id of other objects (UserType, User), because of that I have to do a foreach that gets and completes the secondary objects (UserType, User) after I do a get all of the primary object (Profile), and in my listview I'm trying to make the objects sort by their name, but I don't know how.

Image of the code that completes the secondary objects

List<Profile> lista = SqlProfile.GetAll(listOrder);
List<Profile> listatemp = new List<Profile>();
Profile profile;

foreach (Profile p in lista)
{
    profile = p;
    profile.UserEscolhido = SqlUser.Get(p.UserEscolhido.Id);
    profile.TipoUser = SqlUserType.Get(p.TipoUser.Id);
    listatemp.Add(profile);
}

listatemp.Sort();
ListView.ItemsSource = listatemp;

I use MySql if that helps in any way

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
J game
  • 1

0 Answers0