C# - generic List and ConvertAll() Method, how does it internally work?
- by msfanboy
Hello,
from some code I found in Sacha Barbers free mvvm framework chinch I saw this:
return new DispatcherNotifiedObservableCollection<OrderModel>(
DataAccess.DataService.FetchAllOrders(
CurrentCustomer.CustomerId.DataValue).ConvertAll(
new Converter<Order, OrderModel>(
OrderModel.OrderToOrderModel)));
FetchAllOrders returns a List<Order> for a certain customerID.
This list is converted to a List<OrderModel> or in other words List<OrderViewModel>.
How can that happen? What must be the requirements/conditions, that every property of the Order object in the List<Order> is converted into a property of the OrderModel ?