Reputation: 6138
I need to find a compatible method, if exists, in a class code. Is there some simpler way in Roslyn to do that otherwise I have to compare method names, number and types of arguments. It wouldn't be a big deal if we would not have to deal with arguments' non-fully qualified types and inheritance.
Upvotes: 0
Views: 103
Reputation: 18976
Roslyn provides all the pieces you need. You might want to look at the SymbolEquivalenceComparer that lives in the Roslyn codebase (but it's not public) for inspiration on how to do the comparison. You'll have to do the comparison checks yourself, but that should be a whopping 20 lines of code or so if you do it right.
As an important note, make sure you're working with the semantic model of Roslyn versus just syntax. You mentioned non-qualified types -- as long as you're working with semantics syntax differences like that are taken care of for you.
Upvotes: 1