c# - IEnumerable<T>'requires '1' type arguments -
in order make changes in dll given used iaspectprovider interface , satisfy required provideaspects method. as
public class traceaspectprovider : iaspectprovider { readonly sometracingaspect aspecttoapply = new sometracingaspect(); public ienumerable provideaspects(object targetelement) { assembly assembly = (assembly)targetelement; list instances = new list(); foreach (type type in assembly.gettypes()) { processtype(type, instances); } return instances; } void processtype(type type, list instances) { foreach (methodinfo targetmethod in type.getmethods(bindingflags.instance | bindingflags.public | bindingflags.declaredonly)) { instances.add(new aspectinstance(targetmethod, aspecttoapply)); } foreach (type nestedtype in type.getnestedtypes()) { processtype(nestedtype, instances); } } } while running getting these error
waiting valuable comments
if @ the documentation provideaspects(), notice returns ienumerable<aspectinstance>, that's have use in code too:
public class traceaspectprovider : iaspectprovider { readonly sometracingaspect aspecttoapply = new sometracingaspect(); public ienumerable<aspectinstance> provideaspects(object targetelement) { assembly assembly = (assembly)targetelement; list<aspectinstance> instances = new list<aspectinstance>(); foreach (type type in assembly.gettypes()) { processtype(type, instances); } return instances; } void processtype(type type, list<aspectinstance> instances) { foreach (methodinfo targetmethod in type.getmethods(bindingflags.instance | bindingflags.public | bindingflags.declaredonly)) { instances.add(new aspectinstance(targetmethod, aspecttoapply)); } foreach (type nestedtype in type.getnestedtypes()) { processtype(nestedtype, instances); } } }
Comments
Post a Comment