I need to take a list and Linq it such that I come out with something suitable for a sql “in”. This is what I am using now. Is there a cleaner Linq way to get this "(333,333,54445,56667)"
List<int> vendorIds;
string snipet = "";
for (int i = 0; i < vendorIds.Count; i++)
{
snipet += (i > 0) ? "," + vendorIds[i].ToString() : vendorIds[i].ToString();
}
Just wondering.
In .NET <= 3.5
In .NET >= 4
I prefer to write myself a method for that like: