Need help with Merge GeoProcess task in ArcEngine (C#)

Discussion created by tim2u on Dec 14, 2011
Latest reply on Dec 15, 2011 by tim2u
Help!  Having the hardest time getting the correct syntax when adding layers as gp parameters to call the Merge_management GeoProcessing Task.  Below is just one of MANY, MANY ways I have tried with no luck.  Can anyone help? 

I've successfully called many GeoProcessing tasks via code in ArcEngine, but this is the first one to take what appears to be an array ( ie. [layer1,layer2,etc]) as one of the parameters.

        public void RunMergeGeoProcess(ILayer SourceLayer1, ILayer SourceLayer2, string ResultFeatureClassName, string GeoDBAbsFileName)

            IFeatureLayer featureLayerSource1 = (IFeatureLayer)SourceLayer1;
            IFeatureLayer featureLayerSource2 = (IFeatureLayer)SourceLayer2;

            _geoProcessor.SetEnvironmentValue("Workspace", GeoDBAbsFileName);

            IWorkspace refWS = ((IDataset)featureLayerSource1.FeatureClass).Workspace;
            string dbPath = refWS.PathName;
            IDataset myDS1 = featureLayerSource1.FeatureClass as IDataset;
            string mysDS1 = dbPath + "\\" + myDS1.Name;
            IDataset myDS2 = featureLayerSource2.FeatureClass as IDataset;
            string mysDS2 = dbPath + "\\"+ myDS2.Name;

            string myResult = dbPath + "\\" + ResultFeatureClassName;

            string param1 = "[" + mysDS1 + ", " + mysDS2 + "]";


                _geoProcessor.OverwriteOutput = true;
                _geoProcessor.Execute("Merge_management", _gpParams, null);
            catch (Exception ex)
                MessageBox.Show("There was a GeoProcessing Error." + ex.ToString());