We added support in Synergy .NET for the OverloadResolutionPriority attribute, which allows you to influence method overload resolution. When multiple overloaded methods are applicable to a method call, the overload with the highest priority value is selected. (The default priority is 0, and higher values indicate higher priority.) This attribute can be helpful when introducing a newer overload (e.g., a more performant implementation) and you want future builds to prefer it without requiring changes to existing calls. For example, in the code below, both overloads of PrintValue are applicable for the call Example.PrintValue(5). Because the short overload has a higher priority, it is selected:
public class Example
public static method PrintValue, void
value, int
proc
Console.WriteLine("int overload")
endmethod
{OverloadResolutionPriority(1)}
public static method PrintValue, void
value, short
proc
Console.WriteLine("short overload")
endmethod
endclass
main
proc
Example.PrintValue(5)
end