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
?
How to get underlying type for IEnumerable<T> with Roslyn?
942 views Asked by dubtar At
1
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 theTypeArguments
property.Side note: To get the open generic type, use
ConstructedFrom
, notOriginalDefinition
.