Search found 81 matches

by baramuse
Thu Jan 02, 2025 11:42 am
Forum: Product
Topic: Optional parameters from X# to C#
Replies: 3
Views: 387

Re: Optional parameters from X# to C#

Hi Chris !

and thanks for your answer but my understanding was that if I do pass a NULL to the c# function, then it should use default ?
So you're saying that as null is valid for the string argument, it does not take the default value right ?

I learned something then thanks :)
by baramuse
Wed Jan 01, 2025 2:30 pm
Forum: Product
Topic: Optional parameters from X# to C#
Replies: 3
Views: 387

Optional parameters from X# to C#

Hi and a very happy new year to everyone !

I stumble upon a strange behaviour when calling c# functions from a x# project:

I have a c# function having an optional string parameter with a default value:

public static void DefaultParameterTest(string defautvalue = "default")
{
Console.WriteLine ...
by baramuse
Mon Nov 18, 2024 2:55 pm
Forum: Product
Topic: Calling convention of overriden methods
Replies: 4
Views: 591

Re: Calling convention of overriden methods


Basile,
If the class is a DbServer subclass then it has to be:

PUBLIC METHOD SetFilter( cFiltre ) AS USUAL

Robert


I tried that but then it's complaining about not having a type :

Severity Code Description Project File Line Suppression State
Error XS1031 Type expected Locasyst.WebServices ...
by baramuse
Mon Nov 18, 2024 2:31 pm
Forum: Product
Topic: Calling convention of overriden methods
Replies: 4
Views: 591

Calling convention of overriden methods

Hi,

I'm trying to target Vo as dialect, code is Vulcan.net for now
But I have two last errors I can't figure out :
Error XS9041 Override of virtual method 'SetFilter' in child class has STRICT calling convention but overridden method in parent class is CLIPPER. Locasyst.WebServices.Lib.XSharp ...
by baramuse
Mon Nov 18, 2024 11:52 am
Forum: Product
Topic: optional parameter
Replies: 8
Views: 703

Re: optional parameter


Hi Basile,

I was not aware of that, thanks! So the (roslyn) compiler can be setup so that it does not even allow assigning null to "regular" reference types! But when I try this in X#

LOCAL c AS STRING?
c := NULL

the compiler reports "warning XS8632: The annotation for nullable reference ...
by baramuse
Mon Nov 18, 2024 11:44 am
Forum: Product
Topic: optional parameter
Replies: 8
Views: 703

Re: optional parameter


Thank you Robert.

The aps.net project id indeed c#.

Does that means I would need to have my XSharp library as a Core dialect project in order to be able to use optional parameters ?

well, I don't think I can convert the Xsharp lib to Core dialect so I'll just create overloads.

But now I ...
by baramuse
Mon Nov 18, 2024 11:16 am
Forum: Product
Topic: optional parameter
Replies: 8
Views: 703

Re: optional parameter

@Chris,

yes indeed, I was trying nullable before (like the other following parmeters)
And also no, I'm writing a lot of more modern c# and there is a difference between string and string? (starting c#8) that can come handy, when specifying APIs for example

https://learn.microsoft.com/en-us/answers ...
by baramuse
Mon Nov 18, 2024 11:00 am
Forum: Product
Topic: optional parameter
Replies: 8
Views: 703

Re: optional parameter

Thank you Robert.

The aps.net project id indeed c#.

Does that means I would need to have my XSharp library as a Core dialect project in order to be able to use optional parameters ?
by baramuse
Mon Nov 18, 2024 10:39 am
Forum: Product
Topic: optional parameter
Replies: 8
Views: 703

optional parameter

Hi,

I'm trying to understand when the compiler is complaining about a decalred optional parameter.
I have my function in a Xsharp project :

METHOD LocCreation( cCodeClient AS STRING, cMotDePasse AS STRING, aArticleLoc AS List<ArticleLoc>, dtDebutLoc AS DATETIME, dtFinLoc AS DATETIME, dtDepart AS ...
by baramuse
Fri Sep 20, 2024 9:34 am
Forum: Product
Topic: supported visual studio version
Replies: 3
Views: 687

Re: supported visual studio version

awesome !

do you know since which version of VS2022 ?
I just reinstalled my machine so got the latest one (17.11.4)

that reminds me I need to register for the summit !

regards.