PdfRpt.DataSources.CrosstabDataSource.processIEnumerables C# (CSharp) Method

processIEnumerables() private method

private processIEnumerables ( ICollection list, object columnObject ) : void
list ICollection
columnObject object
return void
        private void processIEnumerables(ICollection<CellData> list, object columnObject)
        {
            foreach (var keyValue in (IEnumerable)columnObject)
            {
                object key = null;
                object value = null;
                foreach (var column in keyValue.GetType().GetProperties())
                {
                    if (column.Name == "Z")
                        key = column.GetPropertyValue(keyValue);
                    if (column.Name == "V")
                        value = column.GetPropertyValue(keyValue);
                }

                if (key == null)
                    throw new InvalidOperationException("key/PropertyName is null. Source should be the result of the CrosstabExtension.Pivot method here.");

                list.Add(new CellData
                {
                    PropertyName = key.ToString(),
                    PropertyValue = value,
                    PropertyIndex = _index++
                });

                if (_topFieldsAreVariableInEachRow)
                {
                    if (!_topFields.Contains(key.ToString())) _topFields.Add(key.ToString());
                }
            }
        }