Link Details

Link 803913 thumbnail
User 866503 avatar

By BlackRabbitCoder
Published: Jun 09 2012 / 10:22

We’ve seen how the Select() extension method lets you project a sequence from one type to a new type which is handy for getting just parts of items, or building new items. But what happens when the items in the sequence are already the type you want, but the sequence itself is typed to an interface or super-type instead of the sub-type you need? For example, you may have a sequence of Rectangle stored in an IEnumerable> and want to consider it an IEnumerable> sequence instead. Today we’ll look at two handy extension methods, Cast>() and OfType>() which help you with this task.
  • 5
  • 0
  • 725
  • 478
User 866503 avatar

BlackRabbitCoder replied ago:

0 votes Vote down Vote up Reply

new post

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Apache Hadoop
Written by: Piotr Krewski
Featured Refcardz: Top Refcardz:
  1. Play
  2. Akka
  3. Design Patterns
  4. OO JS
  5. Cont. Delivery
  1. Play
  2. Java Performance
  3. Akka
  4. REST
  5. Java