Wolfgang pointed me to a feature he called One line syntax, if I understood well, this is the equivalent of C#'s:
string cTest ="x"
directly within the code.
That seemed like a good idea to solve warnings XS103 e.g. in error handlers TRY/CATCH giving:
Warning CS0168 The variable 'e' is declared but never used
But I can't find this back in the help. I just defined a variable without declaring, this of course gives XS103 and the help says very promising " The following example resolves the error." except the sample box is empty...
How do I write string cTest ="x" in X#?
Dick
X# equivalent of C# string cTest (One line syntax)
X# equivalent of C# string cTest (One line syntax)
Hi Dick,
var cTest := "x"
or
LOCAL cTest := "x" AS STRING
Stefan
var cTest := "x"
or
LOCAL cTest := "x" AS STRING
Stefan
X# equivalent of C# string cTest (One line syntax)
Hello Stefan,
That's quick!
Ok, it's that simple....
And indeed it works and is indeed very convenient.
I will paste a dozen of local cMessage:=e:Message as string or so which saves an equal number of warnings.
Dick
That's quick!
Ok, it's that simple....
And indeed it works and is indeed very convenient.
I will paste a dozen of local cMessage:=e:Message as string or so which saves an equal number of warnings.
Dick
X# equivalent of C# string cTest (One line syntax)
Hi Dick,
In order to solve the problem with this exact issue, the compiler in the latest build supports a new syntax for CATCH:
CATCH AS Exception
(so no variable name). You can use this one to get rid of the warning, in places when you do not really need to use the Excaption variable (I know, there are plenty such situations).
hth,
Chris
In order to solve the problem with this exact issue, the compiler in the latest build supports a new syntax for CATCH:
CATCH AS Exception
(so no variable name). You can use this one to get rid of the warning, in places when you do not really need to use the Excaption variable (I know, there are plenty such situations).
hth,
Chris
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
X# equivalent of C# string cTest (One line syntax)
Hello Chris,
That's even better, in quite some situations!
Dick
CATCH AS Exception
That's even better, in quite some situations!
Dick