您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
47 行
1.1 KiB
47 行
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace UnityEditor.Graphing.Util
|
|
{
|
|
public static class UIUtilities
|
|
{
|
|
public static bool ItemsReferenceEquals<T>(this IList<T> first, IList<T> second)
|
|
{
|
|
if (first.Count != second.Count)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for (int i = 0; i < first.Count; i++)
|
|
{
|
|
if (!ReferenceEquals(first[i], second[i]))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static int GetHashCode(params object[] objects)
|
|
{
|
|
return GetHashCode(objects.AsEnumerable());
|
|
}
|
|
|
|
public static int GetHashCode<T>(IEnumerable<T> objects)
|
|
{
|
|
var hashCode = 17;
|
|
foreach (var @object in objects)
|
|
{
|
|
hashCode = hashCode * 31 + (@object == null ? 79 : @object.GetHashCode());
|
|
}
|
|
return hashCode;
|
|
}
|
|
|
|
public static IEnumerable<T> ToEnumerable<T>(this T item)
|
|
{
|
|
yield return item;
|
|
}
|
|
}
|
|
}
|