简体   繁体   中英

How do I find an INamedTypeSymbol for an instance of ITypeParameterSymbol?

I want to iterate over parameters of a particular INamedTypeSymbol and recurse into them in the case those type parameters are generic themselves. However I can't do that, because the type parameters are returned as ITypeParameterSymbol and the generic parameters are only available on INamedTypeSymbol.

How do I find an INamedTypeSymbol for an instance of ITypeParameterSymbol?

You want TypeArguments , not TypeParameters .

TypeParameters returns the declared type parameters of the member declaration (the open/unconstructed generic type). These are never named types.

TypeArguments returns the types that have been substituted (if the type is a closed/constructed type).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM