Created
March 18, 2025 02:26
-
-
Save pingkunga/11618386e48b2d05aa464fef842dae13 to your computer and use it in GitHub Desktop.
Back to Basic: Fundamental Data Structure in C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void ProcessTransactionWithOnlyList(IList<TransactionDTO> pTransactions, IList<PortfolioDTO> pPortfolios, IList<PortPriceSouceDTO> pPortPriceSources) | |
{ | |
// Iterate through transactions and find corresponding portfolio | |
foreach (var transaction in pTransactions) | |
{ | |
// Use LINQ to find the portfolio with the matching PortfolioId | |
var portfolio = pPortfolios.FirstOrDefault(p => p.PortfolioId == transaction.PortfolioId); | |
if (portfolio != null) | |
{ | |
// You can save or process the transaction with the portfolio here | |
//.... | |
} | |
var portPriceSource = pPortPriceSources.FirstOrDefault(p => p.PortfolioId == transaction.PortfolioId); | |
if (portPriceSource != null) | |
{ | |
// You can save or process the transaction with the portfolio here | |
//.... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment