using System.Collections;
double overallPerformance;
throw new ArgumentException("Id can not be less or equal than 0.");
public string Manufacturer
get { return manufacturer; }
while(helpVar.Contains(" "))
if(value == null || helpVar == null)
throw new ArgumentException("Manufacturer can not be empty.");
while(helpVar.Contains(" "))
if(value == null || helpVar == null)
throw new ArgumentException("Manufacturer can not be empty.");
throw new ArgumentException("Price can not be less or equal than 0.");
public double OverallPerformance
get { return overallPerformance; }
throw new ArgumentException("Overall Performance can not be less or equal than 0.");
overallPerformance = value;
public Product(int id, string manufacturer, string model, decimal price, double overallPerformance)
this.Manufacturer = manufacturer;
this.OverallPerformance = overallPerformance;
public string ToString(string productType)
return "Overall Performance: " + this.OverallPerformance + "Price: " + this.price + " - " + productType + ": " + this.Manufacturer + "\n" + this.model + "(Id:" + this.ID + ")";
class Component : Product
get{ return generation; }
set {generation = value;}
public Component(int id, string manufacturer, string model, decimal price, double overallPerformance, int generation)
: base(id, manufacturer, model, price, overallPerformance)
this.Generation = generation;
override public string ToString()
return "Overall Performance: " + this.OverallPerformance + "Price: " + this.Price + " - " + "Component" + ": " + this.Manufacturer + "\n" + this.Model + "(Id:" + this.ID + ")" + " Generation " + this.Generation;
static Hashtable table = new Hashtable();
static void newComponent(int id, string manufacturer, string model, decimal price, double overallPerformance, int generation)
new Component(id, manufacturer, model, price, overallPerformance, generation);
table.Add ("AddComponent", new Action<int, string, string, decimal, double, int>(newComponent));
public static void Main()
Console.WriteLine(table["AddComponent"]);