c# - Roslyn: get the symbol for a type defined in a third-party library -


using roslyn/microsoft.codeanalysis, how can isymbolfor third-party type, ie, type defined in referenced assembly not part of solution? in particular case, i'm looking json.net's jobject, same question valid bcl stuff stringbuilder etc.

the idea i've come far implement csharpsyntaxwalker looks method invocations, property accesses , constructor calls, checks whether made on type i'm interested in , if yes, gets symbol respective syntaxnode. i'm going implement now, seems awfully cumbersome. think there must better way, google-fu has not yielded relevant results.

maybe background: i'm trying replace usage of jobject usage of class.

if can access compilation can call compilation.gettypebymetadataname() , pass in qualified metadata name symbol.

be careful of nested classes , generics, metadata names different they're normal qualified names. more see: c# : having "+" in class name?

once have symbol can find usages via symbolfinder.findallreferences()


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -