public static class MathToolss
{
public static bool ListEquals<T>(this IEnumerable<T> one, IEnumerable<T> another)
{
if (one.Count() != another.Count()) return false;
return (one.Except(another)).Count() == 0;
}
}
使用
public class TSTest : MonoBehaviour
{
List<int> AAA;
List<int> BBB;
private void Start()
{
AAA = new List<int>();
BBB = new List<int>();
AAA.Add(2);
AAA.Add(1);
AAA.Add(5);
AAA.Add(4);
BBB.Add(4);
BBB.Add(2);
BBB.Add(5);
BBB.Add(1);
Debug.LogError(AAA.ListEquals(BBB));
}
}