Ender91
Ender91

Reputation: 71

How to display a single property from a list of objects

I'm trying to display a single property from a list of objects in the front end like so. DocumentRepoVaccineTypes is the list of objects in the View model. The information that is displayed in the front end is this in the column "System.Collections.Generic.HashSet`1[EHS.Entities.DocumentRepositoryVaccineTypes]"

public virtual ICollection<DocumentRepositoryVaccineTypes> DocumentRepoVaccineTypes { get; set; }

 <td>
   @document.DocumentRepoVaccineTypes
 </td>

Upvotes: 1

Views: 170

Answers (1)

dom
dom

Reputation: 6832

@String.Join(", ", document.DocumentRepoVaccineTypes.Select(type => type.SomeProperty))

Upvotes: 2

Related Questions