[英]How to get the type constraint list from INamedTypeSymbol
I have a type that comes as INamedTypeSymbol , his definition like this:我有一个INamedTypeSymbol类型,他的定义是这样的:
public interface IFoo<TFoo> where TFoo: class
{
TFoo Foo{ get; set; }
}
How can I get the constraint list?如何获取约束列表? (here is: where TFoo: class )
(这里是:其中 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. INamedTypeSymbol 有一个
TypeParameters
可以让您进入TFoo
,该类型参数符号具有各种属性( ConstraintTypes
、 HasReferenceTypeConstraint
等)以查看存在哪些约束。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.