我有这个类的属性,我想知道如何从类中访问它们。 ServedClassName
是一个自定义属性,这是我实际尝试访问的属性。如何在C#中访问其中的类的属性
[Guid("24889af6-e174-460b-ab52-7fb5a925926e")]
[ServedClassName("ASCOM ProxyClient Telescope")]
[ProgId("ASCOM.DeviceProxyClient.Telescope")]
[ClassInterface(ClassInterfaceType.None)]
public class Telescope : ReferenceCountedObjectBase, ITelescopeV3
要访问的ProgID,我用这个:Marshal.GenerateProgIdForType(this.GetType());
反射不是一个选项? – allen 2013-02-28 17:18:00
'TypeDescriptor.GetAttributes':http://msdn.microsoft.com/en-us/library/6w3a7b50%28v=vs.100%29.aspx 'Type.GetCustomAttributes':http://msdn.microsoft。 com/en-us/library/system.type.getcustomattributes.aspx – IAbstract 2013-02-28 17:18:07