In this example:
abstract class MyList<T>: List<T>
{
public T Find(int? id)
{
foreach(T obj in this)
{
if(Compare(id, obj))
return obj;
}
return default(T);
}
protected abstract bool Compare(int? id, T obj);
}
I get the error
foreach statement cannot operate on variables of type
LearningScriptSharp.MyList<T>becauseLearningScriptSharp.MyList<T>does not contain a public definition forGetEnumerator.
How can I enumerate this list?
Firstly, apparently one can’t define a generic type in Script#… compiler fails, without error messages.
So I’m going to go with this, unless anyone has a better suggestion: