How can I get an underlying type from ITypeSymbol
for IEnumerable<MyType>
? I see ITypeSymbol.OriginalDefinition
contains link to IEnumerable<>
, but where can I get ITypeSymbol
for MyType
?
Generic type parameters are a feature of named types (as opposed to arrays or pointers).
You need to cast to INamedTypeSymbol
; you can then look at the TypeArguments
property.
Side note: To get the open generic type, use ConstructedFrom
, not OriginalDefinition
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With