SortedList
-
Hi guys does anyone know how to check if a sortedlist is empty or not? I tried using the 'capacity' and keys|values 'count' property but none work Anyone with a different approach? help Morg
-
Hi guys does anyone know how to check if a sortedlist is empty or not? I tried using the 'capacity' and keys|values 'count' property but none work Anyone with a different approach? help Morg
Capacity
won't tell you if it's empty or not (if it's 0 then it's empty, but it could be empty and > 0).Count
should - what doesn't work about it?Dave
If this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
Hi guys does anyone know how to check if a sortedlist is empty or not? I tried using the 'capacity' and keys|values 'count' property but none work Anyone with a different approach? help Morg
Use the Count property:
SortedList<int, string> sl = new SortedList<int, string>(); sl.Add(4, "four"); sl.Add(3, "three"); MessageBox.Show(sl.Count.ToString());
Gives "2".
SortedList<int, string> sl = new SortedList<int, string>(); //sl.Add(4, "four"); //sl.Add(3, "three"); MessageBox.Show(sl.Count.ToString());
Gives "0".
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
-
Hi guys does anyone know how to check if a sortedlist is empty or not? I tried using the 'capacity' and keys|values 'count' property but none work Anyone with a different approach? help Morg
-
Hi guys does anyone know how to check if a sortedlist is empty or not? I tried using the 'capacity' and keys|values 'count' property but none work Anyone with a different approach? help Morg
return ( 42 ) ;
-
Hi guys does anyone know how to check if a sortedlist is empty or not? I tried using the 'capacity' and keys|values 'count' property but none work Anyone with a different approach? help Morg
-
Capacity
won't tell you if it's empty or not (if it's 0 then it's empty, but it could be empty and > 0).Count
should - what doesn't work about it?Dave
If this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Cool it works fine now...it was just logic