In the code below, I'm adding a parameterValue for each row in the parameters datatable.
However, I'm getting the following error:
"The type arguments for method 'EnumerableRowCollectionExtensions.Select(EnumerableRowCollection, Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly."
Can someone help me understand what type argument I need to explicitly define in the code?
Here is the code with the error:
parameters.AsEnumerable().Select(x =>
{
ParameterValue parameterValue = new ParameterValue();
parameterValue.Name = x["name"].ToString();
parameterValue.Value = x["value"].ToString();
parameterList.Add(parameterValue);
});
This works fine in a foreach loop. Here is the code for that:
foreach (DataRow row in parameters.Rows)
{
ParameterValue parameterValue = new ParameterValue();
parameterValue.Name = row["name"].ToString();
parameterValue.Value = row["value"].ToString();
parameterList.Add(parameterValue);
}