Show/Hide Toolbars

XSharp

Member 'name' implements interface member 'name' in type 'type'. There are multiple matches for the interface member at run-time. It is implementation dependent which method will be called.

 

This warning can be generated when two interface methods are differentiated only by whether a particular parameter is marked with ref or with out. It is best to change your code to avoid this warning because it is not obvious or guaranteed which method is called at runtime.

 

Although X# distinguishes between out and ref, the CLR sees them as the same. When deciding which method implements the interface, the CLR just picks one.

 

To avoid this warning

 

1.Give the compiler some way to differentiate the methods. For example, you can give them different names or provide an additional parameter on one of them.

Example

 

The following code generates XS1956 because the two Test methods in Base differ only by the ref/out modifier on the first parameter.

 

 

// XS1956.prg