Answer the question
In order to leave comments, you need to log in
How to merge lists from two files?
There are two files, one is a list of clients, the other is a list of client accounts. There are also 2 ListViews, one list of clients, and the second one should display the client's accounts (there can be 2 of them), that is, when a client is selected from the first ListView, the second one should contain accounts of only this client. Also, the files contain the IDs of clients, by which you can find the accounts of this client in the second file.
Answer the question
In order to leave comments, you need to log in
It looks like you need something like this:
var clients = GetClients(); // Каким-то образом получили клиентов
var accounts = GetAccounts(); // Каким-то образом получили список счетов
var clientsWithAccounts = (
from client in clients
let accountsForClient = accounts.Where(account => account.ClientId == client.Id).ToArray() // Предполагаем, что у счёта есть какой-то идентификатор клиента, по которому его можно сопоставить. И что у одного клиента может быть несколько счетов
select new { Client = client, Accounts = accountsForClient }).ToArray();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question