Reputation: 3
I have a type that comes as INamedTypeSymbol, his definition like this:
public interface IFoo<TFoo> where TFoo: class
{
TFoo Foo{ get; set; }
}
How can I get the constraint list? (here is: where TFoo: class)
Upvotes: 0
Views: 202
Reputation: 19021
INamedTypeSymbol has a TypeParameters
which will get you to TFoo
, that type parameter symbol has various properties (ConstraintTypes
, HasReferenceTypeConstraint
, etc.) to see what constraints exist.
Upvotes: 1