[Solved] Concatenate a string for DisplayFor


Add the strings that you want in a list, e.g.:

var str = New List<string>();
if (!string.IsNullOrEmpty(model.Address.ReferenceKey)) {
  str.Add(model.Address.ReferenceKey);
}

Then join the strings:

return string.Join(",", str);

1

solved Concatenate a string for DisplayFor