string.join(",", Contacts.Select(x=>x.Name); //Name is a property of an object(Contact) in the list of Contacts
This blog is primarily a compilation of frequently faced issues by developers with solutions which I have implemented to solve them
Friday, November 6, 2015
Generate a comma separated string from an IEnumerable object
Labels:
C#,
comma separated string
Solution Architect employed with Mercedes Benz with about 14 years of experience in Microsoft Technologies.
Wednesday, November 4, 2015
Simple yet effective way to find if IEnumerable has elements or not
bool IsEmpty(IEnumerable en)
{
foreach(var c in en) { return false; }
return true;
}
Labels:
C#,
IEnumerable
Solution Architect employed with Mercedes Benz with about 14 years of experience in Microsoft Technologies.
Subscribe to:
Posts (Atom)