Ambiguous method: ToHashSet (Linq vs Sirenix.Utilities)
Issue #794
resolved
-
What happened?
- Get an error message: CS0121: The call is ambiguous between the following methods or properties: 'Sirenix.Utilities.LinqExtensions.ToHashSet<T>(System.Collections.Generic.IEnumerable<T>)' and 'System.Linq.Enumerable.ToHashSet<TSource>(System.Collections.Generic.IEnumerable<TSource>)'
-
How can we reproduce it?
-
```csharp using System; using System.Collections.Generic; using System.Linq; using Sirenix.Utilities;
static HashSet<Type> scriptableObjectTypes = AssemblyUtilities.GetTypes(AssemblyTypeFlags.CustomTypes) .Where(t => t.IsClass && typeof(ScriptableObject).IsAssignableFrom(t) && !typeof(EditorWindow).IsAssignableFrom(t) && !typeof(Editor).IsAssignableFrom(t)) .ToHashSet(); ```
-
-
What version of Unity are you using?
- 2021.2.0b6
-
What version of Odin are you using? (See "Tools > Odin Inspector > About")
- 3.0.7
-
Do you have Editor Only mode enabled?
- No
-
What operating system are you on?
- macOs 10.15.7
Comments (2)
-
-
- changed status to resolved
Resolved in 3.0.9.0
- Log in to comment
You can use aliases for the Sirenix.Utilities types:
And then remove the Sirenix.Utilities using directive