How do I get value instead of reference from icollection when pullling in cshtml

Viewed 12

I am trying to display the values of an icollection in cshtml nut instead of the value I get the system reference. System.Data.Entity.DynamicProxies.ReferralICD10Code_F7D1453817B346998A38AA8F0A6458AB31F1C8E815585BE8E92F6BBA57298BC8

The icollection is defined as

[Display(Name = "Referral ICD10Codes")]
public virtual ICollection<ReferralICD10Code> ReferralICD10Codes { get; set; }

And when I try to build up the variable to display in the cshtml I am using

    @{ 
        var reficd10codes = "";
        foreach (var item in Model.Visit.ReferralICD10Codes)
        {
            reficd10codes = reficd10codes + " " + Model.Visit.ReferralICD10Codes.FirstOrDefault().ToString();
        }
    }

If I leave out the firstordefault() I get

System.Collections.Generic.HashSet`1[Clinton.Core.Domain.ReferralICD10Code]

So now I am trying to figure out how to get the actual values instead of the reference.

Thanks

0 Answers
Related