It is strange but the source code
public class Processor<T> where T: class
{
...
private object WorkWithSubtype(IRequester nextRequester, Type type)
{
if (type.GetInterface("IList") != null)
{
var originalType = type.GetGenericArguments()[0];
var list = Activator.CreateInstance(type);
var method = typeof(Processor<>).GetMethod("GetObjects", BindingFlags.NonPublic | BindingFlags.Instance).MakeGenericMethod(originalType);
var resList = method.Invoke(this, new object[] { nextRequester });
typeof(List<>).GetMethod("AddRange").MakeGenericMethod(originalType).Invoke(list, new object[] { resList });
return list;
}
}
private IEnumerable<K> GetObjects<K>(IRequester requester) where K: class
{
...
//We can call method WorkWithSubtype in this method sometimes
}
}
And i get "Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.". The exception is throwing at line 'var resList = method.Invoke(this, new object[] { nextRequester });'. Can you help me? Thanks in advance!