I need to get the full CLR name of a particular symbol. This means that for generic types I need the `1
, `2
, etc. appended to types. Now, ISymbol
already has a property MetadataName
which does exactly that. But it excludes surrounding types and namespaces, only giving the name of the symbol at hand.
The usual option for getting a fully-qualified name, i.e. via ToDisplayString
doesn't quite work here because it will not use the MetadataName
for its various parts.
Is there anything like this built-in? Or do I have to just concatenate the chain of ContainingSymbol
s with .
in between? (And are there points where this assumption breaks down?)
EDIT: Just noticed that you need a +
in between individual names if it's a type contained in another type, but apart from that, using .
should work, I guess.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…