dobry den,
Potrebuji pomoci LINQ dotazu vybrat vsechny kurzy, ktere navstevuji vsichni zadani studenti
Trida Student.cs
public class Student
{
public int Id { get; set; }
public string Name { get; set; }
}
Muj dotaz, ktery nefunguje
var result = from m in courses
where m.Student.All(x => x = students)
select m;
//Cannot implicitly convert type 'cviceni.Student[]' to 'cviceni.Student'
List<Student> studenti = new List<Student>
{
new Student
{
Id = 1,
Name = "Jiri Novak"
},
new Student
{
Id = 2,
Name = "Tomas Novacek"
},
new Student
{
Id = 3,
Name = "Petr Novy"
},
};
Student[] students = studenti.ToArray();
XML ma tvar:
<courses>
<course>
<student id="1" name="Jiri Novak" />
<student id="2" name="Tomas Novacek" />
<student id="3" name="Petr Novy" />
</course>
<course>
<student id="1" name="Jiri Novak" />
<student id="2" name="Tomas Novacek" />
<student id="4" name="Jan Tlusty" />
</course>
</courses>