1 | 1 | * The reason `IsArray` returns less objects than checking for `IEnumerable` is that it's quite different if an `Enumerator` of an `IEnumerable` is used rather than going deeper down into the object until an array is reached. An example is the `Dictionary`. `dict is IEnumerable` returns true, resulting in enumerating that dictionary. The implementation of the enumerator reveals that `KeyValuePair<TKey, TValue>` objects are created within the enumerator. If `IsArray` is used, `dict.IsArray` returns false, resulting in a further recursion into the dictionary object. In there an array of `Entry<TKey, TValue>[]` is found, which is then used. So in this example all the `KeyValuePair` objects are missing when `IsArray` is used (which is good!). |