I am trying to concatenate address lines eloquently, delimited by commas, but where a line is null, to omit the comma.
My current proposal is :
public string fullAddress
{
get
{
return $"{address.line1 ?? ""}, {address.line2 ?? ""}, {address.line3 ?? "" } , {address.line4 ?? ""}";
}
}
But the above does not deal with the null commas. What would be a more eloquent way to achieve this?
Thanks in advance.