I am trying to return a list of selected feature attribute field, "mukey" from a feature class, "MUPOLYGON". I tried to look-up the mukey using the GetTable() method and creating a mukey list. However, I am getting an error that says cannot convert a Task to a string parameter when I tried to use the mukey list as a parameter for another method. I have the following questions:
1. What is a light weight method to obtain a mukey list from the selected feature field, mukey?
2. How do I resolve the conversion error?
public async Task LookupMukey()
{
var mukeys = new List<string>();
var MV = MapView.Active;
int mukeyCount = 0;
var SelectionLayer = MV.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(fl => fl.Name.Contains("SelectionLayer")).FirstOrDefault();
await QueuedTask.Run(() =>
{
using (var SelectionTable = SelectionLayer.GetTable())
{
using (var rowCursor = SelectionTable.Search())
{
while (rowCursor.MoveNext())
{
using (Row row = rowCursor.Current)
{
var mukey = Convert.ToString(row["mukey"]);
mukeys.Add(mukey);
mukeyCount++;
}
}
}
}
return mukeys;
});
}
Using the mukey list as a parameter for another method:
Process.ChorizonData(mukeys,"awc_l", "awc_r", "awc_h", inputPath); //error occurs here at mukey
Thanks for your help!