I want to get TypeSyntax from TypeSymbol.
Based on the answer to the Get TypeSyntax from ITypeSymbol question, my solution is Syntax.ParseTypeName(typeSymbol.ToDisplayString()) which doesn't look good.
Is there a more direct solution?
I want to get TypeSyntax from TypeSymbol.
Based on the answer to the Get TypeSyntax from ITypeSymbol question, my solution is Syntax.ParseTypeName(typeSymbol.ToDisplayString()) which doesn't look good.
Is there a more direct solution?
I am not sure if this is what you are looking for but this works forks for me. I get TypeSyntax of declared method parameter using SyntaxReferences this way:
(Symbol.DeclaringSyntaxReferences.First().GetSyntax() as ParameterSyntax).Type