You questions is a bit ambiguous, do you want to get rid of the foreach loop because for loops are faster, because you feel you have one too many loops, or because you want better performance?
Assuming this is a question about enhancing performance, I suggest changing existingHoldings from List to a SortedList where T is the type of Holding.Sector. For best performance Sector should be an integer variable type like an int.
private void CombineHoldings(List<Holding> holdingsToAdd, SortedList<int,Holding> existingHoldings) //Remove ref since List and SortedList are reference types and we are not changing the pointer.
{
for (int i = 0; i < holdingsToAdd.Count; i++)
{
if (existingHoldings.ContainsKey(holdingsToAdd[i].Sector))
{
existingHoldings[holdingsToAdd[i].Sector].Percentage += holdingsToAdd[i].Percentage;
}
else
{
existingHoldings.Add(holdingsToAdd[i].Sector, holdingsToAdd[i]);
}
}
for (int i = 0; i < existingHoldings.Count; i++)
{
existingHoldings.Values[i].Fund = "Combined Funds";
}
}
This method would result in an O(m*log n + n) where n is the number of elements in existingHoldings and m is the number of elements in holdingsToAdd. It is unfortunate that all the existingHoldings elements must have their Fund value updated, as it adds an extra pass through that collection.
Note: if you are constantly adding/removing items from existingHoldings then you could use SortedDictionary which should be faster (SortedList is faster for accessing elements but takes longer adding/removing)
Edit: It is important to note that LINQ is for searching collections, not updating them. As such you could use LINQ to find the holdingsToAdd which do and do not exist in existingHoldings and then loop through existingHoldings setting the Fund and if needed setting Percentage, but then both holdingsToAdd and existingHoldings would need to be ordered and you would still be looping through each collection once. It would be something on the order of O(2*m*log n + n). The compiler might be able to combine the two queries into one call, but even then you would be looking at similar performance with less readability.