I have a SQL Server 2005 database. In a few procedures I have table parameters that I pass to a stored proc as an nvarchar (separated by commas) and internally
nvarchar
Generic
public static DataTable ToTableValuedParameter(this IEnumerable list, Func selector) { var tbl = new DataTable(); tbl.Columns.Add("Id", typeof(T)); foreach (var item in list) { tbl.Rows.Add(selector.Invoke(item)); } return tbl; }