How to define a delegate using Delegate.CreateDelegate instead of Func<>?
问题 I have a method and two delegate like below. It is running in this way. But I want to use Delegate.CreateInstance. The types of the dx and the dy must be Func<IEnumerable<Foo>> . Like below the fx and fy. They must not be Func<int, IEnumerable<Foo>> . public class Test { private IEnumerable<T> CreateItems<T>(int count) where T : class { for (int i = 0; i < count; i++) { yield return (T)Activator.CreateInstance(typeof(T), i.ToString()); } } public List<T> TestMethod<T>(int i = 1) where T :