<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Issue with RemoveByTag]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1026&amp;type=atom" />
	<updated>2019-02-04T19:26:48Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1026</id>
		<entry>
			<title type="html"><![CDATA[Re: Issue with RemoveByTag]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4541#p4541" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Thank you for the bug report.<br />The problem has been fixed.<br />In the next version this will work correctly.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-02-04T19:26:48Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4541#p4541</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Issue with RemoveByTag]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4539#p4539" />
			<content type="html"><![CDATA[<p>In OnlineMapsMarkerManagerBase.cs, the RemoveByTag has<br /></p><div class="codebox"><pre><code>RemoveAll(m =&gt;
        {
            for (int j = 0; j &lt; tags.Length; j++) if (m.tags.Contains(tags[j])) return true;
            return false;
        });</code></pre></div><br /><p>In the &quot;RemoveAll&quot; method, the default for &quot;dispose&quot; is true, so it will go through the predicate sent from above and call Dispose on each element. The Dispose method for the map markers does</p><div class="codebox"><pre><code> tag = null </code></pre></div><p>This poses a problem in the next line of the RemoveAll method that does</p><div class="codebox"><pre><code> items.RemoveAll(match) </code></pre></div><p>this again calls the predicate, but this time &quot;m.tags.Contains...&quot; will throw a null error.</p><p>It seems more efficient to instead have the RemoveAll method be something like this ...</p><div class="codebox"><pre><code>        List&lt;U&gt; matchingItems = items.FindAll(match);
        foreach (U item in matchingItems)
        {
            items.Remove(item);
            if(dispose)
            {
                item.Dispose();
            }
        }

        Redraw();</code></pre></div><p>We heavily use tags and this is killing our port to v3!<br />Thanks!<br />-m</p>]]></content>
			<author>
				<name><![CDATA[vai-ma]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=889</uri>
			</author>
			<updated>2019-02-04T17:54:38Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4539#p4539</id>
		</entry>
</feed>
