Error xs1061 in Compare method
Posted: Mon Feb 03, 2020 10:11 am
Hello,
please see this code:
The error seems to have to do with the fact that the Compare method is using generics.
When I remove the generics part from the method declaration, the code compiles without error.
Wolfgang
please see this code:
Code: Select all
using System.Collections.Generic
class xCompare
public property MyValue as string auto
end class
class xComparer<xCompare> implements IComparer<xCompare>
method Compare( o1 as xCompare, o2 as xCompare ) as int
local nReturn as int
local c1 as string
local c2 as string
c1 := o1:MyValue // error XS1061: 'xCompare' does not contain a definition for 'MyValue' and no accessible extension method 'MyValue' accepting a first argument of type 'xCompare' could be found
c2 := o2:MyValue // error XS1061: 'xCompare' does not contain a definition for 'MyValue' and no accessible extension method 'MyValue' accepting a first argument of type 'xCompare' could be found
nReturn := String.Compare( c1, c2 )
return nReturn
end class
When I remove the generics part from the method declaration, the code compiles without error.
Wolfgang