How to get SyntaxToken.Kind in the current version of Roslyn?

I am trying to update a project that heavily uses comparison with SyntaxToken.Kind. This property seems to have disappeared in newer versions of Roslyn, and I wondered if there was an alternative method or extension method that I could write to get the same functionality?

The code has many links, for example:

if (expression.OperatorToken.Kind == SyntaxKind.PlusEqualsToken)

Any ideas?

+4
source share
1 answer

Add use to Microsoft.CodeAnalysis.CSharp.Syntax, and then use the extension method CSharpKind().

+6
source

Source: https://habr.com/ru/post/1539210/


All Articles