Quantcast
Channel: LINQ equivalent of foreach for IEnumerable - Stack Overflow
Viewing all articles
Browse latest Browse all 23

Answer by neil martin for LINQ equivalent of foreach for IEnumerable

$
0
0

Yet another ForEach Example

public static IList<AddressEntry> MapToDomain(IList<AddressModel> addresses)
{
    var workingAddresses = new List<AddressEntry>();

    addresses.Select(a => a).ToList().ForEach(a => workingAddresses.Add(AddressModelMapper.MapToDomain(a)));

    return workingAddresses;
}

Viewing all articles
Browse latest Browse all 23

Trending Articles