roslyn Semantic Model

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Introduction

In contrast to the Syntax API the exposes all kinds of syntax level information, the semantic model gives our code more "meaning" and allows us to answer questions like "What names are in scope at this location?", "What members are accessible from this method?", "What variables are used in this block of text?", "What does this name/expression refer to?".

Remarks

  • Querying the Semantic Model is more costly than querying the Syntax Tree, due to the fact that it most commonly triggers a compilation.


Got any roslyn Question?