The diffrence between Cast() and OfType() Kevin

 

The difference between the two operators is that the Cast operator will attempt to cast every
element in the collection to the specified type to be put into the output sequence. If there is a type in the
collection that cannot be cast to the specified type, an exception will be thrown. The OfType operator
will only attempt to put those elements that can be cast to the type specified into the output sequence.

from<<Pro.LINQ.Language Integrated Qurey in C Sharp 2010>>

原文地址:https://www.cnblogs.com/kfx2007/p/2537801.html