This is a migrated thread and some comments may be shown as answers.

List within list shows strange behavior

1 Answer 31 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tormod
Top achievements
Rank 1
Tormod asked on 31 Jan 2012, 08:58 AM
Hi.

I have a datasource following this structure:

XNode1
    YNode11 
    YNode12 
    YNode13
XNode2
    YNode21
    YNode22
    YNode23
XNode3
    YNode31
    YNode32

I have created a report that contains a list to the node collection and then a list within that list to bind to the respective nodes' sub nodes.

However, the resulting report is like this

XNode1
    YNode31
    YNode32
XNode2
    YNode31
    YNode32
XNode3
    YNode31
    YNode32

YNode type is a string. XNode type is a class that provides a collection of strings via a iterator (yield return).
I am not using any grouping. This is a list within a list.

My instinct was that the inner list was not bound correctly. However, I cannot think of any way that would produce this behavior. If I dump the bound data object in LINQPad, it displays correctly (so I know the iterators are working).
YNode is displayed by a Textblock using "=Fields.Item".

1 Answer, 1 is accepted

Sort by
0
Tormod
Top achievements
Rank 1
answered on 31 Jan 2012, 10:07 AM
My mistake.

It turns out that the difference between LINQPad and Telerik was the order in which stuff was called.
The iterators used lazy evaluation. When I added .ToList() at the end of the lazy expression, everything works.
Tags
General Discussions
Asked by
Tormod
Top achievements
Rank 1
Answers by
Tormod
Top achievements
Rank 1
Share this question
or