Im having a problem here. im trying to use Parallel.foreach to convert my datatable to a list object. like this .
public List<ProductList> GetProductList(DataTable table)
{
List<ProductList> list = new List<ProductList>();
Parallel.ForEach(table.AsEnumerable(), item =>
{
string sku = item["product_sku"].ToString();
//int skus = Convert.ToInt16(item["product_sku"]);
string price = item["product_price"].ToString();
string tweakerID = item["ID"].ToString();
string finalPrice = item["FinalPrice"].ToString();
list.Add(new ProductList() { SKU = sku, Price = price, ID = id, FinalPrice = finalPrice });
});
list.RemoveAll(item => item == null);
return list;
}
i have over 65000 product rows. and after this . there are only about 63000 products added in to the list. but the result is not a fix number. for example last three times that i ran this code i got 63202 , 64025 , 62920 . and everytime its a new number.
i also get no exception .