И да, реализуйте прежде всего IEnumerable а не только IEnumerable.
public class GenericArray<T> : IEnumerable
{
protected ItemGenericArray<T>[] objs;
public GenericArray()
{
objs = null;
}
public GenericArray(T[] n)
{
objs = new ItemGenericArray<T>[n.Length];
for (int i = 0; i < n.Length; i++)
objs [i] = new ItemGenericArray<T> (n [i]);
}
public int Length
{
get { return objs.Length; }
}
public ItemGenericArray<T> this[int index]
{
get
{
return objs[index];
}
set
{
objs[index] = value;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
for (int i = 0; i < objs.Length; i++)
{
yield return objs[i];
}
}
public class ItemGenericArray<S>
{
public S obj { get; set; }
public ItemGenericArray(S obj)
{
this.obj = obj;
}
}
}
public sealed class AssetObjectGenericArray : GenericArray<Object>
{
private static ObjectSorter.namerAction na;
private static string directory;
public AssetObjectGenericArray(Object[] n, ObjectSorter.namerAction ns, string dir) : base ()
{
objs = new ItemAssetObjectGenericArray[n.Length];
for (int i = 0; i < n.Length; i++)
objs[i] = new ItemAssetObjectGenericArray(n[i]);
na = ns;
directory = dir;
}
public class ItemAssetObjectGenericArray : ItemGenericArray<Object>
{
public Object Obj
{
get
{
return obj;
}
set
{
if (value is Asset) //Assets/EditorPoser/Scripts/ObjectSorter.cs
(666,15): warning CS0184: The given expression is never of the provided (`UnityEditor.VersionControl.Asset') type
{
/*
string path = ((Asset)value).path;
if (na == ObjectSorter.namerAction.sortableFiles)
{
if (path.Contains(directory) && (path.Contains (".jpg") || path.Contains (".png") || path.Contains (".mpeg") || path.Contains (".ogg")))
{
obj = value;
}
}
else
{
if (((Asset)value).isFolder && path.Contains(directory))
{
obj = value;
}
}*/
}
}
}
public ItemAssetObjectGenericArray(Object o) : base(o) { }
}
}