C# and XSharp

This forum is meant for questions and discussions about the X# language and tools
User avatar
Horst
Posts: 327
Joined: Tue Oct 13, 2015 3:27 pm

C# and XSharp

Post by Horst »

Hi
First of all, i have no idea about the DotNet world and Compiler technology. I am using VO2.7 and i am happy. When XSharp is handle DBDCDX and i can simply move my code to XHarp i wanna change to X#. Coz VO is going old and afraid one day the OS will not let it run.

I understand that X# is written with C# and i know there is plenty of C# Code outside. So the question is , is it possible to mix this two 'languages' ? So some modules are from C# and some from X# ? So i can call a C# Function from my X# Code like :

cResult := cFunction ('whatever')

Horst
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

C# and XSharp

Post by Chris »

Hi!

Yes, you can mix as many different languages as you want. Not in the same .exe or .dll file, but from a x# .exe you can use everything that is included in a c# .dll etc and vice versa. Actually, almost all the base .Net Framework classes are written in c#, but can be used of course from every .Net language! Mixing languages is one of the most powerful features of .Net.

Chris
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

C# and XSharp

Post by wriedmann »

Hi Horst,
I understand that X# is written with C# and i know there is plenty of C# Code outside. So the question is , is it possible to mix this two 'languages' ? So some modules are from C# and some from X# ? So i can call a C# Function from my X# Code like :
other than what Chris wrote:

you can have a DLL written in C# that defines a class named "Class1" - this DLL can be your own DLL or from another author, with or without sources is indifferent.

In your X# application then you can use the class1 directly:

oObject1 := Class1{}

or you can create a class that inherits from Class1:

class Class2 inherit Class1

and use the new class:

oObject2 := Class2{}

The more you work with .NET, the more you will find samples for your problems in the internet.

And then .NET gives you completely new concepts:

In VO you write

SLen( cString )

in X# you can write

cString:Length

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Horst
Posts: 327
Joined: Tue Oct 13, 2015 3:27 pm

C# and XSharp

Post by Horst »

I will try it with X# . Hope the DBFCDX support and a little SSATutor is soon avaiable.
FFF
Posts: 1522
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

C# and XSharp

Post by FFF »

wriedmann wrote:And then .NET gives you completely new concepts:
In VO you write

SLen( cString )

in X# you can write

cString:Length

Wolfgang
Well, that needs actually ony keystroke MORE ;) - <s,cr>
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
Frank Maraite
Posts: 176
Joined: Sat Dec 05, 2015 10:44 am
Location: Germany

C# and XSharp

Post by Frank Maraite »

And then .NET gives you completely new concepts:
In VO you write

SLen( cString )

in X# you can write

cString:Length

Wolfgang
Well, that needs actually ony keystroke MORE ;) - <s,cr>
No, type cString:Le and the intellisense does the rest.

By the was, with USING type you can still use the old behaviour of using functions. This you don't need to change your code. Examples will be available later.

Frank
kannanrs
Posts: 6
Joined: Tue Mar 01, 2016 12:09 pm

C# and XSharp

Post by kannanrs »

Hi Guys,

Just want to know if X# is more like C# or like VO and the likes...


Regards

Kannan
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

C# and XSharp

Post by wriedmann »

Hi Kannan,
Just want to know if X# is more like C# or like VO and the likes...
I would say: both.

You can write

Code: Select all

SLen( cString )
as in VO, and

Code: Select all

cString:Length
as in C#.

But the language itself is more VO, as you have if/else/endif, function, method, do case/endcase. X# adds foreach.

The semicolon ";" is a "line continuator" as in VO and Clipper, not a line terminator as in C#, and you don't have to write all these {} as in C#.

The types are specified with "as"

Code: Select all

cString as string
and there will be also arrays, codeblocks and usuals as in VO (currently they are'nt implemented). And there are functions (C# don't knows them).

Wolfgang

P.S. if you like to see X# code, look at the samples forum.
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
kannanrs
Posts: 6
Joined: Tue Mar 01, 2016 12:09 pm

C# and XSharp

Post by kannanrs »

Thank you for the reply.

Since I have not used VO before, except CULE during the Beta days..
I would like to see if I could translate my Clipper/xHarbour project in record time
as I have a version in C#.


Regards
Frank Maraite
Posts: 176
Joined: Sat Dec 05, 2015 10:44 am
Location: Germany

C# and XSharp

Post by Frank Maraite »

Hi Kannan,

i have to convert my clipper apps too this year. Last chance to do that. I want to use most of the code there.

For that I have to to:

- Emulate the TBrowse behaviour as much as possible.
- Design new forms for the READ/GET. Maybe someone is able to do a Facelift (Paul?) for that.

Most of the rest should work with minor changes. The language is very similar.

Frank
Post Reply