I'm creating a tool that would query a dataset and create a query table using a unique ID, then perform some calculations using the query table. Final, it would populate the calculated outputs in an attribute table of a new output feature class. The tools works, but I was wondering if there is a more efficient way of calculating the values and populating the output table. I would like to remove the repetitive method commented below as a separate method, but the problem I'm having is how to find the fields value without having it inside this row cursor loop? Is there a way I can get the field values (e.g. var rArea = row["Shape_Area"]) as the input parameter of the new method? Thanks for your help! Please see a snippet of my code below:
public void AggregateMethod()
{
QueuedTask.Run(() =>
{
FeatureClassDefinition IntersectSortDef = IntersectSort.GetDefinition();
QueryFilter qF = new QueryFilter { WhereClause = $@"{FieldName} = {UniqueID}" };
using (var rowCursor = IntersectSort.Search(qF, false))
{
while (rowCursor.MoveNext())
{
using (Row row = rowCursor.Current)
{
var rArea = row["Shape_Area"];
//Performing the repetitive calculations here
//Ideally, I would like to take this middle part
//and create a separate method with the repetitive
// calculations.
}
}
}
});
//return output values
}