如何找出.net类实现哪些接口? [英] How to find out which interfaces a .net class implements?
问题描述
好,所以我最近一直在学习c#和.net,而 http://msdn.microsoft.com/ (例如 ArrayList doc )是java类的文档中将显示以下内容:
Ok, so I've been learning c# and .net recently and one thing that seems to be missing from the c# documentation on http://msdn.microsoft.com/ that is present in the java documentation (e.g. ArrayList doc) is that a java class's documentation will say something like:
所有已实现的接口:可序列化,可克隆,可迭代,
集合,列表,RandomAccess直接已知的子类:
AttributeList,RoleList,RoleUnresolvedList
All Implemented Interfaces: Serializable, Cloneable, Iterable, Collection, List, RandomAccess Direct Known Subclasses: AttributeList, RoleList, RoleUnresolvedList
这使我能够找出实现了哪些接口,并可能发现我尚不知道的接口。我可以进一步单击一个接口,以获取有关哪些类实现了该接口的信息(无论如何在标准类中)以及哪些接口对其进行了扩展:
This allows me to find out which interfaces it implements and possibly discover interfaces I didn't know of yet. I can further click on an interface and get information on which classes implement it (in the standard classes anyway) and which interfaces extend it:
All Superinterfaces:
Iterable<E>
All Known Subinterfaces:
BeanContext, BeanContextServices, BlockingDeque<E>, BlockingQueue<E>, ...
All Known Implementing Classes:
AbstractCollection, AbstractList, AbstractQueue, AbstractSequentialList, ...
使用Microsoft文档时,我只会得到基类和可能的子类:
When using Microsoft's documentation I only get the base classes and possibly subclasses:
System.Object
System.MarshalByRefObject
System.IO.Stream
More...
更多...是带有子类列表的链接。
"More..." being a link with a list of subclasses.
文档中是否有一种方法可以找到.Net类以与Java文档中类似的方式实现的接口?
Is there a way in the documentation to find what interfaces a .Net class implements in a similar way that we can in the Java documentation?
编辑:我使用的是Visual Studio Express和MSDN上的公开文档,所以我想答案可能是:是的,可以,但是您必须首先支付[Visual Studio | MSDN的正式订阅| ...]。
I'm using Visual Studio Express and the publicly available documentation on MSDN so I suppose that the answer might be: yes you can, but you must pay up first for [full visual studio|MSDN subscription|...].
推荐答案
文档
签出语法部分(例如, IObservableCollection(T))。
这给出了类声明,包括已实现的接口
This gives the class declaration, including implemented interfaces
[SerializableAttribute]
public class ObservableCollection<T> : Collection<T>,
INotifyCollectionChanged, INotifyPropertyChanged
ILSpy
但是,对于没有文档的类,您可以使用反汇编程序,例如 ILSpy 。只需选择一个类,它将显示所有基本类型和派生类型。
However, for classes for which documentation is not available, you can use a dissassembler such as ILSpy. Simply select a class, and it will show all base-types and derived types.
对象浏览器
最后,您还可以在Visual Studio中使用对象浏览器(我不是100%肯定它在Express中)。 查看→ 对象浏览器。这将显示您需要的基本类型。
Object Browser Finally, you can also use the Object Browser in Visual Studio (I'm not 100% sure it's in Express). View → Object Browser. This will show the base-types as you require.
这篇关于如何找出.net类实现哪些接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!