When to use QueuedTask.Run

03-30-2020 11:15 AM
Occasional Contributor II

I see many examples with QueuedTask.Run and am wondering when is the appropriate time to use it. In the examples below why would you want to wait for seemingly simple things like creating a spatial reference or creating a value array? Why is there a need to put these snippets in a QueuedTask.Run task?

// example of using ArcGIS.Core.Geometry.SpatialReference objectvar spatial_ref = await QueuedTask.Run(() => {     return SpatialReferenceBuilder.CreateSpatialReference(3857); });// call MakeValueArray on spatial_ref so that ExecuteToolAsync can internally use the objectvar sr_param = Geoprocessing.MakeValueArray(spatial_ref);

var valueArray = await QueuedTask.Run(() =>
var g = new List<object>() { geometry, };
// Creates a 8000-meter buffer around the geometry object
// null indicates a default output name is used
return Geoprocessing.MakeValueArray(g, null, @"8000 Meters");

Tags (2)
0 Kudos
2 Replies
Regular Contributor
0 Kudos
Occasional Contributor II

Ok let me take a look.

0 Kudos