How to filter to all variants of a generic type using OfType<>

后端 未结 2 579
野性不改
野性不改 2021-01-12 18:27

I want to filter objects in a List using their type, using OfType<>. My problem is, that some objects are of a generic interf

2条回答
  •  难免孤独
    2021-01-12 19:04

    from s in series
    where s.GetType().GetGenericTypeDefinition()==typeof(ITraceSeries<>)
    select s;
    

提交回复
热议问题