I have created a model in ModelBuilder and I need to pass a list of rasters from my code (C#) but until now, ModelBuilder gets only the first record in the array.
I have been passing it in different ways like:
IVariantArray parameters = new VarArrayClass();
parameters.Add(lstRoots);//lstRoots is a list of strings with the root of the raster.
Other way:
foreach (string r in lstRoots) //lstRoots is a list of strings with the root of the raster.
{
parameters.Add(r);
}
And another way:
IVariantArray parameters = new VarArrayClass();
IVariantArray paramlist = new VarArrayClass();
foreach (string r in lstRoots)
{
paramList.Add(r);
}
parameters.Add(paramList);
result = (IGeoProcessorResult)GP.Execute("ModelCellStatistics", parameters, null);
In the model I have created a variable that is the parameter with multiple values: