Via Roslyn, C# syntax ,I have IMethodSymbol to clarify my method information,
var symbolMethod = context.SemanticModel.GetSymbolInfo(invocation).Symbol as IMethodSymbol;
if (symbolMethod == null) return;
//-- Here I need to get other signature of the symbolMethod
Notation: the container class maybe has partial class which includes some signature of this method
Just do symbolMethod.ContainingType, and from there you can call GetMembers to get all members of the type. You can filter by name or whatever you're looking to get from there.
You could look into SemtanticModel.GetMemberGroup
:
var overloads = model.GetMemberGroup(invocation.Expression);
It returns a list of overloads of the method
var symbolMethod = context.SemanticModel.GetSymbolInfo(invocation).Symbol as IMethodSymbol;
//has several signatures
if (symbolMethod.ContainingType.GetMembers().Count(it => it.Name == symbolMethod.Name) > 1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With