Join custom objects into a concatenated string in .NET C#
November 11, 2016 Leave a comment
Say you have the following Customer object with an overridden ToString method:
public class Customer
{
public int Id { get; set; }
public string Name { get; set; }
public string City { get; set; }
public override string ToString()
{
return string.Format("Id: {0}, name: {1}, city: {2}", Id, Name, City);
}
}