In what situation can the text differ from ValueText

In Roslyn (Microsoft.CodeAnalysis), SyntaxToken have Text and ValueText . In all situations that I have observed so far, these two values ​​are the same. ValueText has documentation, but Text does not. As far as I can tell, the only difference.

Why do both exist? In what situation will they differ and why?

+5
source share
1 answer

Why do both exist?

Because they are sometimes different, and both of them are useful.

In what situation will they differ and why?

 int @interface = 123; 

Text token @interface @interface . ValueText - interface . In the text you will learn what text is that appeared in the source code. The value text tells you logically what kind of text is this thing? The escaped keyword used as an identifier is logically the keyword text; what is the name of the identifier.

There are other situations in which text and text meanings may be different; see if you can find them.

+10
source

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


All Articles