Skip to content

Instantly share code, notes, and snippets.

@keijiro
Created June 30, 2015 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keijiro/82028359be65e3f3b088 to your computer and use it in GitHub Desktop.
Save keijiro/82028359be65e3f3b088 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections.Generic;
public class Test : MonoBehaviour
{
void Start()
{
int?[] array1 = { null, null };
int?[] array2 = { null, null };
bool result = array1.ObjectEquals(array2);
Debug.Log("Result:" + result);
}
}
public static class IEnumerableExtensions
{
public static bool ObjectEquals<T>(this IEnumerable<T> e1, IEnumerable<T> e2)
{
var n1 = e1.GetEnumerator();
var n2 = e2.GetEnumerator();
while (n1.MoveNext())
{
n2.MoveNext();
if (!n1.Current.Equals(n2.Current)) return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment