How To Find An Object In A Strongly Typed List ( List<T> )



TODO

Have you ever wanted to find an object in a list of objects?  Did you know you do not need to loop through the list to do so?

 

SOLUTION:

C#

SalesOrder foundSalesOrder = SalesOrderList.SalesOrders.Find(delegate(SalesOrder so) { return so.SalesOrderId == 123; });

 

NOTES:

SalesOrderList is a List<SalesOrder>

SalesOrder is a class that has contains sales order info (ex SalesOrderId, Amount, SaleDate etc.)



Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading