Hi!
I have in my project two classes: User and Entity. I want to create a List of List of these classes. Bellow what i tried.
To see the list i do:
How do i do that?
I have in my project two classes: User and Entity. I want to create a List of List of these classes. Bellow what i tried.
C#:
[COLOR=#2B91AF][FONT=Consolas]List[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]<[/FONT][/COLOR][COLOR=#2B91AF][FONT=Consolas]User[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]>[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] lu [/FONT][/COLOR][COLOR=#000000][FONT=Consolas]=[/FONT][/COLOR][COLOR=#0000FF][FONT=Consolas]new[/FONT][/COLOR][COLOR=#2B91AF][FONT=Consolas]List[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]<[/FONT][/COLOR][COLOR=#2B91AF][FONT=Consolas]User[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]>();[/FONT][/COLOR][COLOR=#2B91AF]List[/COLOR][COLOR=#000000]<[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000]>[/COLOR][COLOR=#000000] le [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]List[/COLOR][COLOR=#000000]<[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000]>();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#2B91AF]User[/COLOR][COLOR=#000000] a [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]User[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#2B91AF]User[/COLOR][COLOR=#000000] b [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]User[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#2B91AF]User[/COLOR][COLOR=#000000] c [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]User[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#2B91AF]User[/COLOR][COLOR=#000000] d [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]User[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000] w [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000] x [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000] y [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000] z [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]Entity[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
lu[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Add[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]a[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
lu[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Add[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]b[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
lu[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Add[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
lu[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Add[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]d[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
le[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Add[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]w[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
le[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Add[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]x[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
le[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Add[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]y[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
le[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Add[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]z[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
[/COLOR][COLOR=green]//This part dont work![/COLOR][COLOR=#000000]
[/COLOR][COLOR=#2B91AF]List[/COLOR][COLOR=#000000]<[/COLOR][COLOR=#2B91AF]List[/COLOR][COLOR=#A31515]<dynamic>[/COLOR][COLOR=#000000]>[/COLOR][COLOR=#000000] l [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]List[/COLOR][COLOR=#000000]<[/COLOR][COLOR=#2B91AF]List[/COLOR][COLOR=#A31515]<dynamic>[/COLOR][COLOR=#000000]>();[/COLOR][COLOR=#000000]
l[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Add[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]lu[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000][FONT=Consolas]l[/FONT][/COLOR][COLOR=#000000][FONT=Consolas].[/FONT][/COLOR][COLOR=#2B91AF][FONT=Consolas]Add[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]([/FONT][/COLOR][COLOR=#000000][FONT=Consolas]le[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]);[/FONT][/COLOR]
To see the list i do:
C#:
[COLOR=#0000FF][FONT=Consolas]foreach[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]([/FONT][/COLOR][COLOR=#0000FF][FONT=Consolas]var[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] p [/FONT][/COLOR][COLOR=#0000FF][FONT=Consolas]in[/FONT][/COLOR][COLOR=#2B91AF][FONT=Consolas]ViewBag[/FONT][/COLOR][COLOR=#000000][FONT=Consolas].[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]usrs[/FONT][/COLOR][COLOR=#000000][FONT=Consolas])[/FONT][/COLOR]
[COLOR=#000000]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#A31515]<tr>[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#A31515]<td>[/COLOR][COLOR=red]@p[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Name[/COLOR][COLOR=#000000]</[/COLOR][COLOR=#000000]td[/COLOR][COLOR=#000000]>[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#A31515]<td>[/COLOR][COLOR=red]@p[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]LasName[/COLOR][COLOR=#000000]</[/COLOR][COLOR=#000000]td[/COLOR][COLOR=#000000]>[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]</[/COLOR][COLOR=#000000]tr[/COLOR][COLOR=#000000]>[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]}[/COLOR]
[COLOR=#2B91AF][FONT=Consolas]How[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] can i [/FONT][/COLOR][COLOR=#0000FF][FONT=Consolas]do[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] that [/FONT][/COLOR][COLOR=#0000FF][FONT=Consolas]with[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] two type of objects[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]?[/FONT][/COLOR]
How do i do that?