using BS.Shared.Interface.Abstract; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BS.Shared.Extensions { public static class AddressExtensions { public static string ToSingleAddressLine(string addressline1, string addressline2, string street, string postalcode, string town, string state = null, string country = null) { var parts = new List { addressline1, addressline2, street, postalcode, town, state, country }; return string.Join(", ", parts.Where(p => !string.IsNullOrWhiteSpace(p))); } public static string GetSingleAddressLine(this IAddressable addressable) { return ToSingleAddressLine(addressable.AddressLine1, addressable.AddressLine2, addressable.Street, addressable.PostalCode, addressable.Town, addressable.State, addressable.Country); } } }