c# - Operator '==' cannot be applied to operands 'method group' or 'string' -
i have following code:
<span>@model.licenseholder.legalperson.contactdetails.select(x => x.name == "fish")</span>
when run this, error:
operator '==' cannot applied operands 'method group' or 'string'
i don't understand why this.
here can see picture of contactdetails: '
i want access contactdatatype property , compare name-property inside contactdatatype, don't know how it. basically, want this: @model.licenseholder.legalperson.contactdetails.contactdatatype.select(x => x.name == "primaryphone")
you need apply where
not select
function:
<span>@model.licenseholder.legalperson.contactdetails.where(x => x.name == "fish").firstordefault()</span>
or better:
<span>@model.licenseholder.legalperson.contactdetails.firstordefault(x => x.name == "fish")</span>
Comments
Post a Comment