什么是C#中的DispId注释?

例如
public interface IWMPSettings

        [DispId(101)]
        bool autoStart { get; set; }
        [DispId(102)]
        int balance { get; set; }

它是有用的还是只是自动生成编译器?

解决方法

总之,是的,它是有用的,但只有COM发送:

The DispIdAttribute(来自MSDN):

Specifies the COM dispatch identifier (DISPID) of a method,field,or property.

This attribute contains the DISPID for the method,or property it describes. Unique DISPIDs are typically assigned by the common language runtime,but you can use this attribute to assign a specific DISPID to a method. When importing a type library,this attribute is applied to all methods with assigned DISPIDs. This ensures that any managed implementation of the same method retains the same DISPID if exposed to COM.

相关文章

在项目中使用SharpZipLib压缩文件夹的时候,遇到如果目录较深,则压缩包中的文件夹同样比较深的问题。比...
项目需要,几十万张照片需要计算出每个照片的特征值(调用C++编写的DLL)。 业务流程:选择照片...
var array = new byte[4]; var i = Encoding.UTF8.GetBytes(100.ToString("x2"));//...
其实很简单,因为Combox的Item是一个K/V的object,那么就可以把它的items转换成IEnumerable<Dic...
把.net4.6安装包打包进安装程序。 关键脚本如下: 头部引用字符串对比库 !include "WordFunc....
项目需求(Winform)可以批量打印某个模板,经过百度和摸索,使用iTextSharp+ZXing.NetʿreeSp...