The ArcGIS ArcObjects .NET Geoprocessing Class provides you with an easy way to execute GP tools in a pure .NET programming environment. In some cases however, you may want to pass in multiple input values e.g. feature classes, just like you can with the GP tool dialog in ArcCatalog.

So how can you accomplish this with .NET Geoprocessor class?
Well actually, there are three ways:
1. Use the parameterized constructor and separate the string parameters with a “;”.
Dim union As ESRI.ArcGIS.AnalysisTools.Union = New ESRI.ArcGIS.AnalysisTools.Union("c:\temp\test.gdb\states;c:\temp\test.gdb\counties", "c:\temp\Union_Output.shp"
GP.Execute(union, Nothing) 2.
Use the object properties and separate parameters with a “;”.
Dim union As ESRI.ArcGIS.AnalysisTools.Union = New ESRI.ArcGIS.AnalysisTools.Union()union.in_features = "C:\temp\test.gdb\states;C:\temp\test.gdb\counties"
union.out_feature_class = "C:\temp\Union_Output.shp"
GP.Execute(union, Nothing) 3. Use a GpValueTableObject (probably the least widely known method, but very powerful!)
'Feature Class Objects
Dim gpUtils As IGPUtilities2 = New GPUtilitiesClass()
Dim inFeature1 As IFeatureClass = gpUtils.OpenFeatureClassFromString("C:\temp\test.gdb\states")
Dim inFeature2 As IFeatureClass = gpUtils.OpenFeatureClassFromString("C:\temp\test.gdb\counties")'Create and populate a Value Table Object
Dim vt As IGpValueTableObject = New GpValueTableObjectClass()
vt.SetColumns(1)
Dim obj1 As Object = inFeature1
vt.AddRow(obj1)
Dim obj2 As Object = inFeature2
vt.AddRow(obj2)'Run the Tool
Dim union As ESRI.ArcGIS.AnalysisTools.Union = New ESRI.ArcGIS.AnalysisTools.Union()
union.in_features = vt
union.out_feature_class = "C:\temp\Union_Output.shp"
GP.Execute(union, Nothing)
NOTE: If you want to union more than two feature classes then you will need an ArcInfo-level license. See these links for more info:
How to Access Licensing and Extensions for the Geoprocessor
Licensing for Geoprocessing Tools
Learn more about programming with GP in .NET.
What is Geoprocessing?
Geoprocessing Class
How to access geoprocessing tools and toolboxes
How to run a Geoprocessing tool
EDN Team
With contributions from Ralf Gottschalk, ESRI Technical Support
