fix garbage in FilterSignature.Equals
parent
ca912a3b5a
commit
5f0d694eb4
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>x64</Platforms>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
|
|
@ -21,7 +21,25 @@ namespace MoonTools.ECS
|
|||
|
||||
public bool Equals(FilterSignature other)
|
||||
{
|
||||
return Included.SetEquals(other.Included) && Excluded.SetEquals(other.Excluded);
|
||||
// workaround for HashSet<T>.SetEquals generating garbage
|
||||
// maybe fixed in .NET 8?
|
||||
foreach (var included in Included)
|
||||
{
|
||||
if (!other.Included.Contains(included))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var excluded in Excluded)
|
||||
{
|
||||
if (!other.Excluded.Contains(excluded))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
|
|
Loading…
Reference in New Issue