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,
- public
- int
- float
- console
- string
my questions are,
- is there way this. hope can roslyn. can “localdeclarationstatementsyntax” variables. how parse “console” , “concat”. “sytax walker” parses tokens in class option?
- 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
Post a Comment