public ProductBase[] GetProductStock() { List <ProductBase> pbStock = new List <ProductBase>(); try { foreach (Product product in this.productStock) { ProductBase pb = new ProductBase() { Name = product.Name, Id = product.Id }; pbStock.Add(pb); } return(pbStock.ToArray()); } catch (Exception ex) { //Console.WriteLine(ex); this.myLog.LogAlert(AlertType.Error, this.detroitDataSet.LineId.ToString(), ex.TargetSite.ToString(), ex.Source, ex.ToString(), "system"); return(new ProductBase[0]); } //ProductBase[] result = new ProductBase[productStock.Count]; //for (int i = 0; i < productStock.Count; i++) //{ // result[i] = new ProductBase(); // result[i].Name = productStock.ToArray()[i].Name; // result[i].Id = productStock.ToArray()[i].Id; //} //return result; }
public ProductBase[] GetProductBuffer() { List <ProductBase> pbBuffer = new List <ProductBase>(); try { foreach (Product product in this.productBuffer) { ProductBase pb = new ProductBase() { Name = product.Name, Id = product.Id }; pbBuffer.Add(pb); } return(pbBuffer.ToArray()); } catch (Exception ex) { //Console.WriteLine(ex); this.myLog.LogAlert(AlertType.Error, this.detroitDataSet.LineId.ToString(), ex.TargetSite.ToString(), ex.Source, ex.ToString(), "system"); return(new ProductBase[0]); } }