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 )
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.
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.