Is there an easy way to get a count on the values of a specific dictionarys keys values?
static void Main()
{
Dictionary<string, ArrayList> SpecTimes = new Dictionary<string, ArrayList>;
ArrayList times = new ArrayList();
string count = "";
times.Add = "000.00.00";
times.Add = "000.00.00";
times.Add = "000.00.00";
string spec = "A101";
SpecTimes.Add(spec,times);
count = SpecTimes[spec].values.count;
}
I haven't tested it, but this should be close to what you need.
static void Main()
{
Dictionary<string, List<string>> SpecTimes = new Dictionary<string, List<string>>();
List<string> times = new List<string>();
int count = 0;
times.Add = "000.00.00";
times.Add = "000.00.00";
times.Add = "000.00.00";
string spec = "A101";
SpecTimes.Add(spec,times);
// check to make sure the key exists, otherwise you'll get an exception.
if(SpecTimes.ContainsKey(spec))
{
count = SpecTimes[spec].Count;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With