why it says the following ?Error 1 Cannot convert type 'System.Collections.Generic.KeyValuePair<int,Brands.BrandCls>' to 'System.Collections.Generic.KeyValuePair<short,Brands.BrandCls>' F:\C#Progress\RPM\Brands\Brands\BrandCol.cs 34 13 Brands
Code:
using System;
namespace Brands
{
class BrandCol : IEnumerable<BrandCls>
{
// Declare a field to hold a dictionary of BrandCls objects keyed by the Brandid property (an integer)
private Dictionary<int, BrandCls> _brandColl;
// Constructor: instantiate an instance of the dictionary
public BrandCol()
{
_brandColl = new Dictionary<int, BrandCls>();
}
public void AddBrand(BrandCls brandClass)
{
int key = brandClass.Brandid;
if (_brandColl.ContainsKey(key))
{
_brandColl.Add(key, brandClass);
}
}
#region IEnumerable<BrandCls> Members
public IEnumerator<BrandCls> GetEnumerator()
{
foreach (KeyValuePair<Int16, BrandCls> kvp in _brandColl)
{
yield return kvp.Value;
}
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
}
}