Replace List<> with HashSet<>

This commit is contained in:
TSR Berry 2022-12-16 16:43:01 +01:00
parent ed48dfcab6
commit c83f21e932
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2
2 changed files with 5 additions and 4 deletions

View file

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using Ryujinx.CustomTasks.SyntaxWalker;
using Ryujinx.CustomTasks.Helper;
using System.Linq;
using Task = Microsoft.Build.Utilities.Task;
namespace Ryujinx.CustomTasks
@ -15,7 +16,7 @@ namespace Ryujinx.CustomTasks
private const string InterfaceFileName = "IArray.g.cs";
private const string ArraysFileName = "Arrays.g.cs";
private readonly List<string> _outputFiles = new List<string>();
private readonly HashSet<string> _outputFiles = new HashSet<string>();
[Required]
public string ArrayNamespace { get; set; }
@ -58,7 +59,7 @@ namespace Ryujinx.CustomTasks
_outputFiles.Add(filePath);
}
private ICollection<int> GetArraySizes(string itemPath)
private HashSet<int> GetArraySizes(string itemPath)
{
Log.LogMessage(MessageImportance.Low, $"Searching for StructArray types in: {itemPath}");

View file

@ -6,7 +6,7 @@ namespace Ryujinx.CustomTasks.SyntaxWalker
{
class ArraySizeCollector : CSharpSyntaxWalker
{
public ICollection<int> ArraySizes { get; } = new List<int>();
public HashSet<int> ArraySizes { get; } = new HashSet<int>();
private void AddArrayString(string name)
{
@ -17,7 +17,7 @@ namespace Ryujinx.CustomTasks.SyntaxWalker
string rawArrayType = name.Split('<')[0];
if (int.TryParse(rawArrayType.Substring(5), out int size) && !ArraySizes.Contains(size))
if (int.TryParse(rawArrayType.Substring(5), out int size))
{
ArraySizes.Add(size);
}