<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Is the GraphicCollection class thread safe? in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/is-the-graphiccollection-class-thread-safe/m-p/1485624#M12756</link>
    <description>&lt;P&gt;Thank you, this is all very useful.&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":clinking_beer_mugs:"&gt;🍻&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jun 2024 19:14:13 GMT</pubDate>
    <dc:creator>Mike_Quetel</dc:creator>
    <dc:date>2024-06-05T19:14:13Z</dc:date>
    <item>
      <title>Is the GraphicCollection class thread safe?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/is-the-graphiccollection-class-thread-safe/m-p/1485579#M12754</link>
      <description>&lt;P&gt;API docs don't explicitly say, but is the &lt;A href="https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.UI.GraphicCollection.html" target="_self"&gt;GraphicCollection&lt;/A&gt; class thread safe?&amp;nbsp; Use case is that I have a large(ish) number of graphics (25,000 to maybe 100,000)&amp;nbsp; to add to an overlay.&amp;nbsp; Can this task be safely chunked into batches and run in parallel?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 18:14:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/is-the-graphiccollection-class-thread-safe/m-p/1485579#M12754</guid>
      <dc:creator>Mike_Quetel</dc:creator>
      <dc:date>2024-06-05T18:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Is the GraphicCollection class thread safe?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/is-the-graphiccollection-class-thread-safe/m-p/1485595#M12755</link>
      <description>&lt;P&gt;The GraphicCollection class is indeed thread-safe (synchronized).&amp;nbsp; However, the most efficient way to populate it would be to use AddRange method (optimized to reduce temporary allocations and locking/unlocking/eventing overhead).&amp;nbsp; So, yes, you can absolutely parallelize creation of your Graphic objects -- e.g. using&amp;nbsp;Parallel.ForEach with a partitioner -- but I suggest adding Graphics to the collection in batches of several hundred/thousand rather than individually.&lt;/P&gt;&lt;P&gt;We actually have a whole guide topic dedicated to Graphic performance, check it out for more tips:&amp;nbsp;&lt;A href="https://developers.arcgis.com/net/programming-patterns/performance-considerations/#graphics" target="_blank"&gt;Performance considerations | ArcGIS Maps SDK for .NET | ArcGIS Developers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;A couple years ago we also talked about performance for Graphic-heavy apps at DevSummit.&amp;nbsp; You can find a recording of it here:&amp;nbsp;&lt;A href="https://mediaspace.esri.com/playlist/dedicated/250241443/1_jv1v5zry/1_kitmn15d" target="_self"&gt;"ArcGIS Runtime SDK for .NET: Building Apps - Part 2"&lt;/A&gt;&amp;nbsp;(relevant part starts around the 25-minute mark).&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 18:50:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/is-the-graphiccollection-class-thread-safe/m-p/1485595#M12755</guid>
      <dc:creator>MatveiStefarov</dc:creator>
      <dc:date>2024-06-05T18:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Is the GraphicCollection class thread safe?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/is-the-graphiccollection-class-thread-safe/m-p/1485624#M12756</link>
      <description>&lt;P&gt;Thank you, this is all very useful.&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":clinking_beer_mugs:"&gt;🍻&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 19:14:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/is-the-graphiccollection-class-thread-safe/m-p/1485624#M12756</guid>
      <dc:creator>Mike_Quetel</dc:creator>
      <dc:date>2024-06-05T19:14:13Z</dc:date>
    </item>
  </channel>
</rss>

