3
I have a LINQ expression where the result is saved in the variable query, which is transformed into a list, this query returns a series of "RA attributes".
I would like to pass this list of attributes as a parameter in the LINQ expression resulting in query2
. I want the query2
return me all the codes of discipline in which these "RA" are related(Yes, I want to pass them all at once).
I did as below but I did not get results, the code compiled, but it did not work. As I pass the list query
as a parameter in where
? Should I convert this list from 1 a single attribute to a common type? How do I?
void cargarDados(Int32 disc)
{
List<Turma> turmas = db.GetCollection<Turma>("turma").FindAll().ToList();
var query = (from t in turmas
where t.COD_DISCIPLINA == disc
select new
{
t.RA
}).ToList();
var query2 = (from t1 in turmas
where t1.COD_DISCIPLINA.Equals(query)
select new
{
t1.COD_DISCIPLINA
}).ToList();
dataGridView1.DataSource = query2;
}
Thanks Marconcilio, funfou, and with good performance ! Thanks
– Raphael Teodoro