0
public abstract BaseClass
 {
    public abstract Dictionary<T, V> ExtractSummaryInfo<T, V>()
        where V : Product;    
 }

public MyClass : BaseClass
 {
   public override Dictionary<T, V> ExtractSummaryInfo<T, V>()
      {
        Dictionary<T, V> products = new Dictionary<T, V>();

        string id = "HRM";
        Product product = new Product("Product 1");

        products[id as T] = product as V;

        return products;
       }
  }

在我看来,这行代码(products[id as T] = product as V;)是错误的,请告诉我如何实现这个方法?

4

0 回答 0