Tuesday, May 8, 2007

Creating a Dictionary Class in C#.NET

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace ForecastGen.Type
{
public class DicDemand : DictionaryBase
{
public int Item (string MonthYear)
{
return((int)Dictionary[MonthYear]);
}
public ICollection Keys
{
get { return Dictionary.Keys; }
}
public ICollection Values
{
get { return Dictionary.Values; }
}
public bool Contains(string MonthYear)
{
return Dictionary.Contains(MonthYear);
}
public void Add(string MonthYear, int DemandValue)
{
if (Dictionary.Contains(MonthYear) == false)
{
Dictionary.Add(MonthYear, DemandValue);
}
}
public void Remove(string MonthYear)
{
if(Dictionary.Contains(MonthYear)==true)
Dictionary.Remove(MonthYear);
}
}
}

1 comment:

Anonymous said...

Thаnκs fоr finally talκing about > "Creating a Dictionary Class in C#.NET"
< Loved it!

Here is my website mt media templе