I got a “well-constituted” ObservableCollection and I’d like to inspect into it.
The definition of it is :
private Dictionary<string, ObservableCollection<DependencyObject>> _DataPools = new Dictionary<string, ObservableCollection<DependencyObject>>();
(yep it’s an obsCol with an obsCol in it, but it IS ok, the problem’s not here)
I tried 2 different ways but they both don’t work…
1) .Items
foreach(ObservableCollection<DependencyObject> obj in _DataPools.Items)
{
blablaaaa;
....
}
.Items doesn’t work but when I look in the C#doc, Items is a valid field… (just like “Count”, and “Count” works…)
2) Count + [x] acces :
var nbItems = _DataPools.Count;
for (int i = 0; i < nbItems; i++)
{
Console.WriteLine("Items : " + _DataPools[i].XXX); //XXX = ranom method
}
_DataPools[i] doesn’t work but on the web I found a couple of example where it is used oO
I tried a couple of other “exotic” things but I really can’t go over it…
Any help will be welcomed !
Thx in advance and sry for my langage, im french -_-
(sry for my president too !)
_DataPoolis not an observable collection in an observable collection. It’s a dictionary that contains observable collections. To get the collections from the dictionary, use theValuesproperty: