Because the NGWS runtime supports overloaded methods and the IDispatch interface relies solely on method names, rather than complete method signatures, for binding, IDispatch cannot support overloaded methods. In order to provide access to overloaded methods of a class, the ITypeInfo implementation provided by the runtime decorates the names of overloaded methods so that each method name is unique. For example, the System.StringBuilder class has several overloads of the Append method. The COM signature for the methods (as exported by RegAsm) appears as a single Append method followed by a series of decorated Append_x methods, where x starts from 1 and is incremented for each additional overloaded form of the method, as shown in the following table:
NGWS signature | COM signature |
---|---|
Append(Object value) | Append(Object value) |
Append(byte value) | Append_1(byte value) |
Append(short value) | Append_2(short value) |
… | … |
Object browsers display all the decorated forms of the overloaded method, so developers can choose whatever form of the method they require.