archive
/
product-list
Archived
1
Fork 0

Add storage class to store list in memory

This commit is contained in:
Jake Howard 2016-04-15 11:58:13 +01:00
parent b7e983070c
commit f32cf745b6
2 changed files with 31 additions and 1 deletions

29
Storage.cs Normal file
View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
namespace productlist
{
public static class Storage
{
private static List<Product> productStorageList = new List<Product>();
public static void Add(Product p) {
productStorageList.Add (p);
}
private static void listProducts() {
if (productStorageList.Count < 1) {
Console.WriteLine ("No Products found!");
return;
}
foreach (Product p in productStorageList) {
p.display ();
}
}
public static void List() {
listProducts ();
}
}
}

View File

@ -40,9 +40,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Product.cs" />
<Compile Include="UI.cs" />
<Compile Include="Storage.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
</Project>