I have this code where I want to add a collections of Parameters to an SqlCommand.
public void AddParameters(Dictionary<string, object> parameters)
{
if (parameters == null)
return;
foreach(KeyValuePair<string, object> keyValue in parameters)
{
sqlCommand.Parameters.AddWithValue(keyValue.Key, keyValue.Value);
}
}
I want to make it more efficienty without using a loop because I can have a very large collection of parameters. Is there any way to add the entire collection with a single function?