and a conversion operator linq

1.ToArray

Two common usage

Use ILSPY View Enumerable in ToArray

Source Analysis: We found that if the type can be converted to ICollection, we performed last CopyTo method, if it can not be converted to ICollection, then the implementation of foreach.

2.ToList

Source Analysis: If you can convert ICollection, is to use the CopyTo method, if it can not convert one by one to go Add to the list.

 

 

Guess you like

Origin www.cnblogs.com/1016391912pm/p/11983697.html