.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Linq;


public class AccountDto 
{
	public int AccountId { get; set; }
	public string AccountName { get; set; }
	public bool Selected { get; set; }
}

public class AreaDto
{
	public string AreaName { get; set; }
	public AccountDto[] Accounts { get; set; }
}
	
					
public class Program
{
	public static void Main()
	{
		var areas = new AreaDto[] 
		{
			new AreaDto 
			{
				AreaName = "Philippines",
				Accounts = new AccountDto[]
				{
					new AccountDto 
					{
						AccountId = 168,
						AccountName = "Account 168",
						Selected = true
					},
					new AccountDto 
					{
						AccountId = 169,
						AccountName = "Account 169",
						Selected = true
						
					},
					
				}
			},
			new AreaDto 
			{
				AreaName = "China",
				Accounts = new AccountDto[]
				{
					new AccountDto 
					{
						AccountId = 170,
						AccountName = "Account 170"
					},
					new AccountDto 
					{
						AccountId = 171,
						AccountName = "Account 171",
						Selected = true	
					},
					
				}
			},
				
		};
			
		
		var result = 
			from account in areas.SelectMany(area => area.Accounts)
			where account.Selected
			select account.AccountId;
		
		result.Dump();
	}
}
;