Hi Horst,
I don't think you need it since there should be an implicit conversion of the datatypes.
But this is a compiler thing and X# may behave differently than C#.
Wolfgang
C#->X# for dummies
C#->X# for dummies
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
C#->X# for dummies
Horst,
No. When you write
LOCAL amount AS decimal
amount := 100.25
Then the literal will be a double value or a float value (depending on the compiler option /vo14) and a runtime conversion to decimal will be done. 100.25m tells the compiler to use a literal with a decimal type.
Robert
No. When you write
LOCAL amount AS decimal
amount := 100.25
Then the literal will be a double value or a float value (depending on the compiler option /vo14) and a runtime conversion to decimal will be done. 100.25m tells the compiler to use a literal with a decimal type.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
C#->X# for dummies
this error msg drives me crazy,
warning XS0618: 'QRCoder.PayloadGenerator.SwissQrCode.Contact.Contact(string, string, string, string, string, string)' is obsolete: 'This constructor is deprecated. Use WithStructuredAddress instead.' 58,3 Start.prg TestQRCode
i tried ->QRCoder.PayloadGenerator.SwissQrCode.Contact.WithStructuredAddress - like they do it in a c# testsample but in x# comes
error XS0426: The type name 'WithStructuredAddress' does not exist in the type 'QRCoder.PayloadGenerator.SwissQrCode.Contact' 58,3 Start.prg TestQRCode
C# Code
[Obsolete("This constructor is deprecated. Use WithStructuredAddress instead.")]
public Contact(string name, string zipCode, string city, string country, string street = null, string houseNumber = null) : this (name, zipCode, city, country, street, houseNumber, AddressType.StructuredAddress)
{
}
public static Contact WithStructuredAddress(string name, string zipCode, string city, string country, string street = null, string houseNumber = null)
{
return new Contact(name, zipCode, city, country, street, houseNumber, AddressType.StructuredAddress);
}
Horst
warning XS0618: 'QRCoder.PayloadGenerator.SwissQrCode.Contact.Contact(string, string, string, string, string, string)' is obsolete: 'This constructor is deprecated. Use WithStructuredAddress instead.' 58,3 Start.prg TestQRCode
i tried ->QRCoder.PayloadGenerator.SwissQrCode.Contact.WithStructuredAddress - like they do it in a c# testsample but in x# comes
error XS0426: The type name 'WithStructuredAddress' does not exist in the type 'QRCoder.PayloadGenerator.SwissQrCode.Contact' 58,3 Start.prg TestQRCode
C# Code
[Obsolete("This constructor is deprecated. Use WithStructuredAddress instead.")]
public Contact(string name, string zipCode, string city, string country, string street = null, string houseNumber = null) : this (name, zipCode, city, country, street, houseNumber, AddressType.StructuredAddress)
{
}
public static Contact WithStructuredAddress(string name, string zipCode, string city, string country, string street = null, string houseNumber = null)
{
return new Contact(name, zipCode, city, country, street, houseNumber, AddressType.StructuredAddress);
}
Horst
C#->X# for dummies
Horst,
Do not use WithStructuredAddress{} (with curly braces) but WithStructuredAddress()(with parentheses).
This is a static method of the Contact class.
Robert
Do not use WithStructuredAddress{} (with curly braces) but WithStructuredAddress()(with parentheses).
This is a static method of the Contact class.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
C#->X# for dummies
Thanks Robert , its working with that.
my last error lol i hope so
error XS0118: 'qrCode' is a variable but is used like a type 52,8 Start.prg TestQRCode
LOCAL qrCodeData AS QRCodeData
LOCAL qrCode AS QRCode
qrCodeData := qrGenerator:CreateQrCode(payload, QRCodeGenerator.ECCLevel.M)
//Rohdaten-QR-Code erzeugen
qrCode := QRCode {qrCodeData}
QRCode is a class:
namespace QRCoder
{
public class QRCode : AbstractQRCode, IDisposable
{
/// <summary>
/// Constructor without params to be used in COM Objects connections
/// </summary>
public QRCode() { }
public QRCode(QRCodeData data) : base(data) {}
i dont know why X# is complaining ,
Horst
my last error lol i hope so
error XS0118: 'qrCode' is a variable but is used like a type 52,8 Start.prg TestQRCode
LOCAL qrCodeData AS QRCodeData
LOCAL qrCode AS QRCode
qrCodeData := qrGenerator:CreateQrCode(payload, QRCodeGenerator.ECCLevel.M)
//Rohdaten-QR-Code erzeugen
qrCode := QRCode {qrCodeData}
QRCode is a class:
namespace QRCoder
{
public class QRCode : AbstractQRCode, IDisposable
{
/// <summary>
/// Constructor without params to be used in COM Objects connections
/// </summary>
public QRCode() { }
public QRCode(QRCodeData data) : base(data) {}
i dont know why X# is complaining ,
Horst
C#->X# for dummies
Hi Horst,
please find attached a solution with :
A sample coming from GitHub in CSharp
The same, moved to X#, using ILSpy
Both are using the NuGet package of QRCoder.
HTH,
Fab
please find attached a solution with :
A sample coming from GitHub in CSharp
The same, moved to X#, using ILSpy
Both are using the NuGet package of QRCoder.
HTH,
Fab
- Attachments
-
- QRCodeTest.zip
- (8.12 KiB) Downloaded 68 times
XSharp Development Team
fabrice(at)xsharp.eu
fabrice(at)xsharp.eu
C#->X# for dummies
Hi Horst,
For which line do you get the error?
The one you posted should be working correctly, although I would suggest using a different variable name for the local, because right now it's the same as the type. I would suggest changing it to "LOCAL oQRCode AS QRCode" or something similar. Remember that c# is case-sensitive, while X# by default isn't, although you can enable the /cs compiler option and make it case sensitive as well.
For which line do you get the error?
The one you posted should be working correctly, although I would suggest using a different variable name for the local, because right now it's the same as the type. I would suggest changing it to "LOCAL oQRCode AS QRCode" or something similar. Remember that c# is case-sensitive, while X# by default isn't, although you can enable the /cs compiler option and make it case sensitive as well.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
C#->X# for dummies
Hi Chris , hi Fabrice
Fabrice thanks, with your hint (Nuget), i was able to make the X# Code runing with the Nuget dll. then i was on GitHub again, but i did not find the c# sample you put into the zip
Chris, I was also looking inside the dll's with ILSpy and i found out, the class QRCoder is not inside the dll i was compiling with the c# source.
my prg is working now, but only with a dll without sourcecode and i hate that
Thanks your the help, maybe later i will try to fix the c# code
Horst
Attached the Prg incl. dll
Fabrice thanks, with your hint (Nuget), i was able to make the X# Code runing with the Nuget dll. then i was on GitHub again, but i did not find the c# sample you put into the zip
Chris, I was also looking inside the dll's with ILSpy and i found out, the class QRCoder is not inside the dll i was compiling with the c# source.
my prg is working now, but only with a dll without sourcecode and i hate that
Thanks your the help, maybe later i will try to fix the c# code
Horst
Attached the Prg incl. dll
- Attachments
-
- SwissQRCode.ZIP
- (54.66 KiB) Downloaded 70 times
C#->X# for dummies
Horst,
the sample comes from here :
https://github.com/codebude/QRCoder/wik ... -iso-20022
I've just changed the IBan Type, to have something that was "correct"; I have removed the RedCross background, and saved the image to check the generated QRCode with my smartphone.
That said, the NuGet package is 3 months old, where the GitHub source is also 3 months old; I suspect they are the same.
HTH,
Fab
the sample comes from here :
https://github.com/codebude/QRCoder/wik ... -iso-20022
I've just changed the IBan Type, to have something that was "correct"; I have removed the RedCross background, and saved the image to check the generated QRCode with my smartphone.
That said, the NuGet package is 3 months old, where the GitHub source is also 3 months old; I suspect they are the same.
HTH,
Fab
XSharp Development Team
fabrice(at)xsharp.eu
fabrice(at)xsharp.eu
C#->X# for dummies
Hi Hirst,
What does exist, is a namespace named "QRCoder", and there are several classes which have that same namespace. Those are the classes "QRCoder.AbstractQRCode", "QRCoder.AsciiQRCode", "QRCoder.PayloadGenerator" and all the rest you see with ILSpy, but there's no class named simply "QRCoder" indeed. Edit: Oh, there's even a class named "QRCoder.QRCode"!!! Note that in the above class names, by convention we call the first part of the name before the dot as "namespace" and the rest as the "short class name", but in truth the whole thing is what consists the full/real class name.
In addition to that, one of those classes, the class "QRCoder.PayloadGenerator" has a (actually it has a lot) nested class (a class that is defined inside another class definition, with a short name "SwissQrCode". This class, because is a nested class, "inherits" the name of its containing class, resulting to a full name "QRCoder.PayloadGenerator.SwissQrCode". This name has three parts, the namespace, the short class name of the container class and the nested class. And this is the class that you needed to use in your code.
I know, this is very confusing, and that's because of an extremely bizarre (to me) decision by the c# designers to use the dot operator for almost everything in this language...for namespaces, classnames, nested classes, members of the classes, everything! And this makes it very difficult to distinguish what is what when you see code like that, but with (very ) careful reading, you can figure them out at the end.
That's true, there is no class named "QRCoder" in the code, and neither exists one in the dll you are using.Horst wrote: Chris, I was also looking inside the dll's with ILSpy and i found out, the class QRCoder is not inside the dll i was compiling with the c# source.
my prg is working now, but only with a dll without sourcecode and i hate that
What does exist, is a namespace named "QRCoder", and there are several classes which have that same namespace. Those are the classes "QRCoder.AbstractQRCode", "QRCoder.AsciiQRCode", "QRCoder.PayloadGenerator" and all the rest you see with ILSpy, but there's no class named simply "QRCoder" indeed. Edit: Oh, there's even a class named "QRCoder.QRCode"!!! Note that in the above class names, by convention we call the first part of the name before the dot as "namespace" and the rest as the "short class name", but in truth the whole thing is what consists the full/real class name.
In addition to that, one of those classes, the class "QRCoder.PayloadGenerator" has a (actually it has a lot) nested class (a class that is defined inside another class definition, with a short name "SwissQrCode". This class, because is a nested class, "inherits" the name of its containing class, resulting to a full name "QRCoder.PayloadGenerator.SwissQrCode". This name has three parts, the namespace, the short class name of the container class and the nested class. And this is the class that you needed to use in your code.
I know, this is very confusing, and that's because of an extremely bizarre (to me) decision by the c# designers to use the dot operator for almost everything in this language...for namespaces, classnames, nested classes, members of the classes, everything! And this makes it very difficult to distinguish what is what when you see code like that, but with (very ) careful reading, you can figure them out at the end.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu