public string ParseAllAuthors() { if (Authors is null || Authors.Count == 0) { return(string.Empty); } if (Authors.Count == 1) { var author = Authors.First(); var firstName = !string.IsNullOrEmpty(author.FirstName) ? $" {author.FirstName}" : string.Empty; var fathersName = !string.IsNullOrEmpty(author.FathersName) ? $" {author.FathersName}" : string.Empty; var lastName = !string.IsNullOrEmpty(author.LastName) ? $"{author.LastName}" : string.Empty; return($" / {lastName}{firstName}{fathersName}"); } var result = " / "; for (int i = 0; i < Authors.Count - 1; i++) { var author = Authors[i]; result += $"{ConvertAuthorToString(author)}, "; } var lastAuthor = Authors.Last(); result += $"{ConvertAuthorToString(lastAuthor)}"; return(result); }
public string getAuthorNames() { string aux = ""; foreach (Author a in Authors) { aux += a.Name; if (a != Authors.Last()) { aux += ","; } } return(aux); }
public override string ToString() { string lista2 = ""; foreach (Author a in Authors) { lista2 += $"[name={a.Name},email={a.Email},gender={a.Gender}]"; if (a != Authors.Last()) { lista2 += ","; } } string lista1 = "Book[" + Name + ",authors={Authors" + lista2 + "},price=" + Price + ",qty=" + Qty + "]"; return(lista1); }
public override string ToString() { string authorList = ""; foreach (Author a in Authors) { authorList += $"[name={a.Name},email={a.Email},gender={a.Gender}]"; if (a != Authors.Last()) { authorList += ","; } } string stringFormatada = "Book[" + Name + ",authors={Authors" + authorList + "},price=" + Price + ",qty=" + Qty + "]"; return(stringFormatada); }
public string getAuthorNames() { string author = ""; foreach (Author a in Authors) { author += a.Name; if (a == Authors.Last()) { } else { author += ","; } } return(author); }
private IReadOnlyCollection <object> BuildDescriptionItems() { var displayItems = new List <object>(); foreach (var author in Authors) { displayItems.Add(author); if (author != Authors.Last()) { displayItems.Add(", "); } } if (Name != null) { displayItems.Insert(0, this); displayItems.Insert(1, " ("); displayItems.Add(")"); } displayItems.Insert(0, "by "); return(displayItems); }
public override string ToString() { string authors = ""; foreach (Author a in Authors) { authors = authors + $"[name={a.Name},email={a.Email},gender={a.Gender}]"; if (a == Authors.Last()) { } else { authors += ","; } } string stringFinal = "Book[" + Name + ",authors={Author" + authors + "},price=" + Price + ",qty=" + Qty + "]"; return(stringFinal); }