First, the definition of your class is incorrect, because you omit the types of your Brand and Product properties, and the public visibility public must be lowercase.
To use ToString() , you need to override the method in your class:
public class SalesDetail { public string Brand {get; set;} public string Product {get; set;} public override string ToString() { return string.Format("Brand: {0}, Product {1}", Brand, Product); } }
Then you can use Linq to list the Aggregate and display its contents.
var items = SalesList.Select(s => s.ToString()).Aggregate((s, s1) => s + Environment.NewLine + s1); MessageBox.Show(items);
source share