I have the following class in a C # practice application with EntityFramework:
public class Livro
{
public Livro()
{
Autor = new HashSet<Autor>();
}
public int Id { get; set; }
public string Titulo { get; set; }
public int ISBN { get; set; }
public int GeneroId { get; set; }
public int AutorId { get; set; }
public virtual ICollection<Autor> Autor { get; set; }
public virtual Genero Genero { get; set; }
}
When I want to access the attributes of the Genero
class, I do it as if it were a normal class: Genero.Nome
, Genero.Id
, etc ... Now, for class Autor
, as it is a collection, I can not the same result.
I would like to know how to navigate through ICollection<Autor> Autor
to access its attributes.
Thank you.