using System.Collections.Generic;
public Category(int id, string name, ICollection<Forum> forums)
public int Id { get; set; }
public string Name { get; set; }
public ICollection<Forum> Forums { get; set; }
public Forum(int id, string name, ICollection<Topic> topics)
public int Id { get; set; }
public string Name { get; set; }
public ICollection<Topic> Topics { get; set; }
public Topic(int id, string name, string owner, DateTime postDateTime)
PostDateTime = postDateTime;
public int Id { get; set; }
public string Name { get; set; }
public string Owner { get; set; }
public DateTime PostDateTime { get; set; }
public static void Main()
var categories = new List<Category>
new Category(1, "Cat 1", new List<Forum>
new Forum(1, "Forum 1", new List<Topic>
new Topic(1, "Top 1", "User111", DateTime.Now.AddMinutes(-100)),
new Topic(2, "Top 2", "User222", DateTime.Now.AddMinutes(-20))
new Forum(2, "Forum 2", new List<Topic>
new Topic(3, "Top 1", "User111", DateTime.Now.AddMinutes(-30)),
new Topic(4, "Top 2", "User222", DateTime.Now.AddMinutes(-40))
new Category(2, "Cat 2", new List<Forum>
new Forum(3, "Forum 3", new List<Topic>
new Topic(1, "Top 1", "User111", DateTime.Now.AddMinutes(-50)),
new Topic(2, "Top 2", "User222", DateTime.Now.AddMinutes(-60))
new Forum(4, "Forum 4", new List<Topic>
new Topic(3, "Top 1", "User111", DateTime.Now.AddMinutes(-70)),
new Topic(4, "Top 2", "User222", DateTime.Now.AddMinutes(-800))
var users = categories.Select(x=> new {x.Id, LastUser = x.Forums.SelectMany(t => t.Topics).OrderByDescending(o=>o.PostDateTime).FirstOrDefault().Owner});
foreach (var item in users) Console.WriteLine("[" + item.Id + "] " + item.LastUser);