Getting all C # class interfaces in Visual Studio

Is there a way to get a list of all the interfaces of the C # class in the Visual Studio user interface, not step by step laying the chain of the superclass? Even if the list in MSDN would not be useful.

For example, I do not see that without digging .Form IDisposableControl

+4
source share
1 answer

GetInterfaces: typeof(List<string>).GetInterfaces() returns

Type[] (8 items)4 typeof(IList<String>) typeof(ICollection<String>) typeof(IEnumerable<String>) typeof(IEnumerable) typeof(IList) typeof(ICollection) typeof(IReadOnlyList<String>) typeof(IReadOnlyCollection<String>) If you need a specific interface, you can use IsAssignableFrom:

typeof(ICollection).IsAssignableFrom(typeof(List<string>))

returns true

0
source

Source: https://habr.com/ru/post/1696236/


All Articles