for example
public interface IWMPSettings
[DispId(101)]
bool autoStart { get; set; }
[DispId(102)]
int balance { get; set; }
is it useful or is it just auto-generated for compiler? What are COM dispatch identifiers for and when would they be needed in a .NET context?
In short, yes it is useful, but only for COM dispatch:
The DispIdAttribute (from MSDN):
Specifies the COM dispatch identifier (DISPID) of a method, field, or property.
This attribute contains the DISPID for the method, field, 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With