How can we get the first item of the folowing dictionary

  • Thread starter Thread starter r3nv
  • Start date Start date
R

r3nv

Guest
I would like to get the first item in a Dictionary that uses a class.

How can I do this if indexof is not available? I get error with the following code:




KeyValuePair<double,CarsRow> kvp = new KeyValuePair<double,CarsRow>();

foreach (KeyValuePair<double,CarsRow> item in keyArray.Value)
{
if (keyArray.Value[0].Equals(item)) // key not found in dictionary
{
//trying to get the first item from list only...
// indexof doesn't work.
//do something...
}
}


private class CarsRow
{
public int SmallCars;
public int BigCars;

public CarsRow(int mySmallCars, int myBigCars)
{
SmallCars = mySmallCars;
BigCars = myBigCars;
}
}

Continue reading...
 
Back
Top