The context is that I have one cached set of values ββin memory that were expensive to extract and another set of related data that are inexpensive to extract and cannot be cached (business rule). Everything works for me, but I'm just wondering if anyone could think of a less expensive way to do such an update ...
foreach (var nonCachedItem in searchItemsNonCached) { foreach (var cachedItem in searchItemsCached) { if (cachedItem.ID == nonCachedItem.ID) nonCachedItem.Description = cachedItem.Description; } }
this is basically just for matching the cached information with the information I just received. It all works and the load is almost careless, but I'm kind of useful for efficiency.
EDIT: in the above example, searchItemsNonCached and searchItemsCached are both SearchItem lists, where Searchitem is a custom object.
source share