The default equality comparer for arrays in C# will only find two arrays to be equal if they both have the same reference. If you replace your declaration of varray[0] with this:
varray[0] = array1;
You'll now find that the contains check returns true. Though there are a few ways to deal with this, one particularly clean one is to use the contains overload which allows you to specify a custom equality comparer. Then you would write
(varray.Contains(array1, new SequenceEqualityComparer()))
And your equality comparer class would be:
public class SequenceEqualityComparer : IEqualityComparer<IEnumerable<int>>
{
public bool Equals(IEnumerable<int> x, IEnumerable<int> y)
{
return x.SequenceEqual(y);
}
public int GetHashCode(IEnumerable<int> obj)
{
return obj.GetHashCode();
}
}
== array1[i]and don't use< 2use< varray.lengthand check for&& i < array1.lengthinif()