Tuesday, February 12, 2013

List.ToLookup Example in C#



Sometimes when we have a list of objects and we need to look up that collection by a member item in the object, we could easily benefit from converting a List collection into a Lookup collection. For example, we need to look up an entire product's inventory in a store by their Supply Date or by their price etc.
             So, to get a Lookup from a list we use the extension method "ToLookup" available in a List collection's extension methods.

I wrote an article on this topic recently for CShap Corner Site. Please go through following link:

http://www.c-sharpcorner.com/UploadFile/0f68f2/creating-a-lookup-from-a-list-of-objects-using-lambda-expres/


No comments:

Post a Comment