-1
讓我儘可能簡單地解釋我的問題。 假設我在另一個類中有一類產品在列表中捕獲事件<object> C#
class Product {
public event EventHandler Product_Changed;
int _productId ;
int productID {
get { return _productId}
set{
_productId = value;
Product_Changed(this,null); // Raise an event that the product Changed
}}
string productName {get;set;}
}
然後,我需要使用的產品列表,每當產品編號中的任何項目的改變,我必須趕在產品類中定義的事件
Class Order
{
List<Product> OrderProduct = new List<Product>();
OrderProduct.Add (new Product());
// Then I change the productId like
OrderProduct[0].ProductID=10 ; // I want to catch the Product_Changed
}
請幫