How to get various types used in a C# project with Roslyn -


i analyzing converting existing c# library java. start need know types / built-in keywords used in existing c# library. mean, example

public class csharpclass { int i; float j; console.writeline(string.concat("a","b")); } 

in class types/keywords used are,

  1. public
  2. int
  3. float
  4. console
  5. string

my questions are,

  1. is there way this. hope can roslyn. can “localdeclarationstatementsyntax” variables. how parse “console” , “concat”. “sytax walker” parses tokens in class option?
  2. also how classes project file roslyn?

you need semantics -- syntax text see , that's get, nothing more, nothing less. compilation project, can call getsemanticmodel give tree, , there can call gettypeinfo or getsymbolinfo (as appropriate, search online difference between these two) type information.

as far getting compilation, if you're writing command line tool want use msbuildworkspace load project. if you're analyzing projects open in visual studio, use visualstudioworkspace, etc.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -