score:2

Accepted answer
var customer = model.mycustomers.firstordefault();
if (customer != null)
{
   var name = customer.name;
}

score:1

@if (model.mycustomers == null || !model.mycustomers.any())
{
    <p>no customer found.</p>
}
@else
{
    [ put the markup for each property here ]
}

score:1

 model.mycustomers == null ? string.empty : model.mycustomers.any() 
       ? model.mycustomers.first().name : string.empty;

Related Query

More Query from same tag