Reputation: 13983
Compilation model has method Compilation.GetTypeByMetadataName
with the following description:
Gets the type within the compilation's assembly and all referenced assemblies (other than those that can only be referenced via an extern alias) using its canonical CLR metadata name.
But how do I get the type from extern alias
assembly?
From docs it follows, that I need to know alias namespace
name, but I want to compare ITypeSymbol
with a known type. It's weird I cannot specify type and original assembly name.
Update:
After pondering a bit, I came to conclusion that it is impossible. I can reference two identically named assemblies located in separate folders. So again, I need to know their alias names to properly specify type name.
Upvotes: 1
Views: 59
Reputation: 19021
So you can do this sequence of operations:
And if you need to go in the reverse direction, there's Compilation.GetMetadataReference which takes the assembly symbol.
Upvotes: 1