M
Mike P
I am working through some LINQ examples on MSDN, and I have come across
some code that doesn't seem to work here :
http://msdn.microsoft.com/en-us/vcsharp/aa336753.aspx
Is this the right way to use collection initialisers or is this way that
I have found on another website correct :
List<Product> productList = new List<Product>
{
new Product
{
ProductID = 1, ProductName = "Chai", Category =
"Beverages", UnitPrice = 18.0000M, UnitsInStock = 39
},
new Product
{
ProductID = 2, ProductName = "Chang", Category =
"Beverages", UnitPrice = 19.0000M, UnitsInStock = 17
},
new Product
{
ProductID = 3, ProductName = "Aniseed Syrup", Category =
"Condiments", UnitPrice = 10.0000M, UnitsInStock = 13
}
some code that doesn't seem to work here :
http://msdn.microsoft.com/en-us/vcsharp/aa336753.aspx
Is this the right way to use collection initialisers or is this way that
I have found on another website correct :
List<Product> productList = new List<Product>
{
new Product
{
ProductID = 1, ProductName = "Chai", Category =
"Beverages", UnitPrice = 18.0000M, UnitsInStock = 39
},
new Product
{
ProductID = 2, ProductName = "Chang", Category =
"Beverages", UnitPrice = 19.0000M, UnitsInStock = 17
},
new Product
{
ProductID = 3, ProductName = "Aniseed Syrup", Category =
"Condiments", UnitPrice = 10.0000M, UnitsInStock = 13
}