当尝试遍历如下列表时,我将如何实现foreach
循环?
ProductCollection myCollection = new ProductCollection
{
Products = new List<Product>
{
new Product { Name = "Kayak", Price = 275M},
new Product { Name = "Lifejacket", Price = 48.95M },
new Product { Name = "Soccer ball", Price = 19.60M },
new Product { Name = "Corner flag", Price = 34.95M }
}
};