Given a MethodDeclarationSyntax object, how can I find out a method declaring a type?
My actual problem is that I need to find out if the reference method of the interface method is used or not.
For example, given the code below, if I have a MethodDeclarationSyntax method for the Dispose () method, how can I conclude that this is an implementation of IDisposable.Dispose ()?
using System;
abstract class InterfaceImplementation : IDisposable
{
public abstract void Dispose();
}
I tried to get a method declaring the type (and checking the type) without success (the Parent property returns me the InterfaceImplementation class).
I also tried to capture the semantic symbol for the method:
var methodSymbol = (MethodSymbol) semanticModel.GetDeclaredSymbol(methodDeclaration);
but could not find anything that could help me.
Ideas?
source
share