lundi 28 mars 2016

Selecting a class method using Lambda Expression

Currently in my code I have a method like this:

.AddMethod(nameof(IRoleService.GetRoles))

What Im trying to do is selecting the interface method using lambda expression and then get the name of method inside AddMethod. So the result would be :

.AddMethod<IRoleService>(x=> x.GetRoles)

I have tried this:

AddMethod<T>(Expression<Func<T, Action>> expression);

But the problem is some of the interface methods have input parameters which I'm trying to ignore, as I just need the method name. Would be thankful if you help me with this.

Alex





Aucun commentaire:

Enregistrer un commentaire