Home

OutOfMemoryException: Array dimensions exceeded supported range.

I'm running the following code on a dataset just 4 columns wide and 34 rows. I keep receiving the exception above. I'am running linqpad beta V5.07 any CPU. Should i see this error in a 64 environment?

code below:

 public static Dictionary<TZerokey, Dictionary<TFirstKey, Dictionary<TSecondKey, TValue>>> PivotExtended<TSource, TZerokey, TFirstKey, TSecondKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TZerokey> zerokeySelector, Func<TSource, TFirstKey> firstKeySelector, Func<TSource, TSecondKey> secondKeySelector, Func<IEnumerable<TSource>, TValue> aggregate)
        {
            var retVal = new Dictionary<TZerokey, Dictionary<TFirstKey, Dictionary<TSecondKey, TValue>>>();
            var k = source.ToLookup(zerokeySelector);

            foreach (var pitem in k)
            {
                var pdict = new Dictionary<TFirstKey, Dictionary<TSecondKey, TValue>>();
                retVal.Add(pitem.Key, pdict);
                var l = pitem.ToLookup(firstKeySelector);
                //			
                foreach (var item in l)
                {
                    var dict = new Dictionary<TSecondKey, TValue>();
                    pdict.Add(item.Key, dict);
                    var subdict = item.ToLookup(secondKeySelector);
                    foreach (var subitem in subdict)
                    {
                        dict.Add(subitem.Key, aggregate(subitem));
                    }

                }


            }

            return retVal;
        }
Thanks in advance
Kad

Comments

Sign In or Register to comment.