Getting all types that implement an interface

前端 未结 17 1011
不思量自难忘°
不思量自难忘° 2020-11-22 00:34

Using reflection, how can I get all types that implement an interface with C# 3.0/.NET 3.5 with the least code, and minimizing iterations?

This is what I want to re-

17条回答
  •  不知归路
    2020-11-22 01:15

    OfType Linq method can be used exactly for this kind of scenarios:

    https://docs.microsoft.com/fr-fr/dotnet/api/system.linq.enumerable.oftype?view=netframework-4.8

提交回复
热议问题