Код: Выделить всё
var isOpen = inventory.Inventory.Where(i => i.IsOpen).ToList();
if (isOpen.Any())
{
foreach (var inventoryItem in isOpen)
{
inventoryItem.Address1 = FormatAddress(inventoryItem.Address1);
inventoryItem.Address2 = FormatAddress(inventoryItem.Address2);
}
}
Код: Выделить всё
private string FormatAddress(string address)
{
if (string.IsNullOrWhiteSpace(address))
{
return "";
}
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
string formattedAddress = textInfo.ToTitleCase(address);
return formattedAddress;
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... eld-in-the
Мобильная версия