Synergy .NET now supports params parameters on selected collection types--e.g., Span<T> (cf. https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-13#params-collections)--in addition to arrays. This works like params T[], but instead of collecting arguments into an array, the compiler collects them directly into the specified collection type.
public class Totals public static method Total, int
params values, Span<int> proc data sum, int, 0 foreach data v in values sum += v endforeach mreturn sum endmethod endclass
mainproc Console.WriteLine(Totals.Total(1, 2, 3)) ;6
end
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
endclassmain
proc Example.PrintValue(5) end
myarray ,13[d1] dvar ,d2 . . . myvar = myarray(dvar)
begin data ok, boolean, true if (!ok) Console.WriteLine("Fail") end
Professional Services Looking for help to advance your Synergy applications?