using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BiskLog_Point_Of_Sale.Classes { public static class distinctive { public static void AddParametersWithValues1(this SqlCommand cmd, string parameterName, params T[] values) { var parameterNames = new List(); for (int i = 0; i < values.Count(); i++) { var paramName = @"@distinctive" + i; cmd.Parameters.AddWithValue(paramName, values.ElementAt(i)); parameterNames.Add(paramName); } cmd.CommandText = cmd.CommandText.Replace(parameterName, string.Join(",", parameterNames)); } } }