Hello friends!
I'm newbie in c# and 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.
- List<User> lu =newList<User>();List<Entity> le =newList<Entity>();
-
- User a =newUser();
- User b =newUser();
- User c =newUser();
- User d =newUser();
-
- Entity w =newEntity();
- Entity x =newEntity();
- Entity y =newEntity();
- Entity z =newEntity();
-
- lu.Add(a);
- lu.Add(b);
- lu.Add(c);
- lu.Add(d);
-
- le.Add(w);
- le.Add(x);
- le.Add(y);
- le.Add(z);
-
-
- List<List<dynamic>> l =newList<List<dynamic>>();
- l.Add(lu);l.Add(le);
To show this list:
- foreach(var p inViewBag.usrs)
- {
- <tr>
- <td>@p.Name</td>
- <td>@p.LasName</td>
- </tr>
- }
How can i do that? Create and show a List of List of different objects?