I am analyzing about converting an existing C# library to java. To start with I need to know what are the types / built-in keywords used in the existing C# library. I mean, for example
public class CSharpClass
{
int i;
float j;
Console.Writeline(String.Concat("A","B"));
}
In this class the types/Keywords used are,
My Questions are,
You need to semantics as well -- syntax is just the text you see and that's exactly what you get, nothing more, nothing less. Get a Compilation
for your project, then you can call GetSemanticModel
where you give it a tree, and then from there you can call GetTypeInfo
or GetSymbolInfo
(as appropriate, search online for the difference between these two) to get type information.
As far as getting the Compilation
, if you're writing a command line tool you probably want to use MSBuildWorkspace
to load your project. If you're analyzing the projects open in Visual Studio, use VisualStudioWorkspace
, etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.