How To Convert List<T> To A Comma Separated String



TODO:

Have you ever wanted to convert a List<string> to a comma delimited string?

 

SOLUTION:

List<string> list = new List<string>();

list.Add("blah");
list.Add("blah1");
list.Add("blah2");
list.Add("blah3");

string result = String.Join(",", list.ToArray());

 

NOTES:

There are no notes on this topic.

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.)