My mistake,
the first argument is the target table.
using ArcGIS.Desktop.Core.Geoprocessing;
await QueuedTask.Run(() =>
{
Geoprocessing.ExecuteToolAsync("AddField_management", Geoprocessing.MakeValueArray(@"c:\temp\demo.gdb\sample", "FieldName", "LONG", 9));
});
When you are working with layers in your map this would be that way to get the location:
FeatureLayer firstLayer = MapView.Active.Map.Layers.OfType<FeatureLayer>().FirstOrDefault();
await QueuedTask.Run(() =>
{
FeatureClass fc = firstLayer.GetTable() as FeatureClass;
Datastore ds = fc.GetDatastore();
string dc = ds.GetConnectionString();
if (ds is Geodatabase)
{
Geodatabase gdb = fc.GetDatastore() as Geodatabase;
string gdbPath = gdb.GetPath();
}
string name = fc.GetName();
});