using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class TestGenericCollections : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       Customer c1 = new Customer("334", "Thomas", "Hobbes", "123-4567");
       Customer c2 = new Customer("123", "Jean-Jacques", "Rosseau", "456-1267");
       Customer c3 = new Customer("085", "David", "Hume", "564-7823");
       Customer c4 = new Customer("254", "Martin", "Heidegger", "253-6383");

       EntityCollection<Customer> customers = new EntityCollection<Customer>();
       customers.Add(c1);
       customers.Add(c2);
       customers.Add(c3);
       customers.Add(c4);

       lboxCustomers.DataSource = customers;
       lboxCustomers.DataBind();

       labCustomer.Text = customers[2].Name;
       chkValidCustomer.Checked = customers.IsValid();

       Product p1 = new Product("1", "ProductOne", 24.00);
       Product p2 = new Product("2", "", 59.00);

       EntityCollection<Product> products = new EntityCollection<Product>();
       products.Add(p1);
       products.Add(p2);

       lboxProducts.DataSource = products;
       lboxProducts.DataBind();

       labProduct.Text = products[0].Name;
       chkValidProducer.Checked = products.IsValid();


       // EntityCollection<String> will_not_work = new EntityCollection<String>();
    }

}
