Dynamic Proxying IEnumerable<T>

870 Views Asked by At

I'm trying to create a dynamic proxy to a list of objects of a specific class. For example:

var proxy = generator.CreateInterfaceProxyWithoutTarget(typeof (IEnumerable<string>),
                                                        interceptor);

But I get the following exception:

Cannot resolve method System.Collections.Generic.IEnumerator`1[System.__Canon] GetEnumerator() because the declaring type of the method handle System.Collections.Generic.IEnumerable`1[T] is generic. Explicitly provide the declaring type to GetMethodFromHandle.

I'm trying to proxy an IEnumerable<> in order to cache calls to generate the list itself.

0

There are 0 best solutions below