Copying from EntityCollection to EntityCollection impossible?

后端 未结 3 852
我在风中等你
我在风中等你 2021-01-22 22:13

How would you do this (pseudo code): product1.Orders.AddRange(product2.Orders);

However, the function \"AddRange\" does not exist, so how would you copy all items in the

3条回答
  •  故里飘歌
    2021-01-22 22:41

    Yes, the usual collection related functions are not there.

    But,
    1. Did you check CopyTo method?
    2. Do you find any problem with using the iterator? You know, GetEnumerator, go through the collection and copy the entities?

    The above two can solve your problems. But, I'm sure in .NET 3.0+ there would be compact solutions.

    My answers are related to .NET 2.0

提交回复
热议问题