I'm trying to run the Merge tool using ArcObjects c# .Net. I'm fairly new to the skill but I have been able to run other tools such as Buffer and Points to Line. However, I have met my match with Merge because it requires more than one input (two layers). Would anyone have an idea how I'm suppose to put two layers into "MergeTool.inputs"? I think right now, my Layer1 is being replaced by Layer2 so when the tool runs, I end up with just one layer being merged into nothing and I get the same layer returned.
IMxDocument pMxDoc = ArcMap.Application.Document as IMxDocument; IMap map = pMxDoc.FocusMap; Geoprocessor GPMerge2 = new Geoprocessor(); ESRI.ArcGIS.DataManagementTools.Merge MergeTool = new ESRI.ArcGIS.DataManagementTools.Merge(); MergeTool.inputs = Layer1; MergeTool.inputs = Layer2; MergeTool.output = OutputName; GPMerge2.Execute(MergeTool, null);
Edit: I've seen some solutions to use semicolon and quotes. Something like MergeTool.inputs = "Layer1;Layer2" But I'm actually using some variables and I can't get the exact path to the layers to make it into a string. The difference can be seen below if I try to do that. I also want to try and keep this set of code if possible and not set up parameter array.