xsharp.eu • C# and XSharp
Page 1 of 2

C# and XSharp

Posted: Wed Mar 09, 2016 9:42 am
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

C# and XSharp

Posted: Wed Mar 09, 2016 11:23 am
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

C# and XSharp

Posted: Thu Mar 10, 2016 6:48 am
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

C# and XSharp

Posted: Thu Mar 10, 2016 10:12 am
by Horst
I will try it with X# . Hope the DBFCDX support and a little SSATutor is soon avaiable.

C# and XSharp

Posted: Thu Mar 10, 2016 3:44 pm
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>

C# and XSharp

Posted: Thu Mar 10, 2016 4:57 pm
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

C# and XSharp

Posted: Fri Mar 11, 2016 9:26 am
by kannanrs
Hi Guys,

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


Regards

Kannan

C# and XSharp

Posted: Fri Mar 11, 2016 9:36 am
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.

C# and XSharp

Posted: Fri Mar 11, 2016 10:29 am
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

C# and XSharp

Posted: Fri Mar 11, 2016 11:32 am
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