更新时间:2022-06-11 21:29:34
通过使用 TcKs 的答案,也可以使用以下 LINQ 查询来完成:
By using the answer from TcKs it can also be done with the following LINQ query:
bool isBar = foo.GetType().GetInterfaces().Any(x =>
x.IsGenericType &&
x.GetGenericTypeDefinition() == typeof(IBar<>));