Introduction

Welcome to a world premiere. A book about X#

Gone are the days when a book about Visual Objects was a both kind of sensation and very much needed as well. Nowadays developers search the Internet, the official X# forum at https://www.xsharp.eu (which is usually the best way to start), StackOverflow (which surprisingly has little X# content to offer) or ChatGPT respectively CoPilot within Visual Studio (which also cannot provide much intelligence when it comes to X# due to a probably small "codebase").

Since nobody wants to read a book with 800+ pages anymore, I decided to write a book that contains only a small amount of "theory" but instead as many examples as possible. The examples about database access will be helpful because there is not so much X# specific information available (although everything you can read about database access with C# or Visual Basic can be applied 100% to X# too of course)

I really hope you will find this book helpful,

Peter Monadjemi

Esslingen am Neckar, September 2023

PS: Please send me comments and especially error corrections or if any of the examples do not work as expected at info@activetraining.de. For any technical question about the syntax or the future direction of X#, the X# forum is a better place to ask for help.

Who is this book for?

This is an important question right at the beginning because xBase, Visual Objects, the .Net Framework, the different options for accessing a database (ADO.Net, DBServer, RDE), and the language X# are each big topics by themselves. This book is 90% about the language X#, the syntax, and how to make the most of the class library that is part of the .Net Runtime. The rest is about using Visual Studio and XIDE as IDE for developing applications with X#. This book is not about how to develop X# applications with a UI and a database layer and all the other topics that were covered in the Visual Objects books that were popular in the 90s. And it's also not about how to successfully port existing VO applications to .Net. And it`s not a beginner's book either. The author assumes that the readers are familiar with writing code in a modern computer language.

Which X# version?

This book and all the examples are currently based on X# version 2.14 although this is not the latest version and there might be some changes in newer versions that affect some of the examples. The Visual Studio Extension for X#, which is discussed in Chapter 4, gets better with each version. That means for example that some of the restrictions of the expression evaluator mentioned in Chapter 4 will not exist anymore with the current version.

The X# samples and where to find them

The most important part of these books is the many small sample programs (mostly console applications). They are all part of a public repo on GitHub :

https://github.com/pemo11/X-Kompendium-Examples

You should clone this repo with the git-command line tool, a GUI git tool, or download it as a zip file directly from the website of that repo.


Important: There is no need to register or log in since it is a public repo.


The repo is organized in subdirectories for each chapter to make it easier to find a specific example. The name of the file is always shown at the top of each example in the book.

Most of the examples are "self-contained". That means, that there are no dependencies. The samples can be compiled independently of the others with the command line version of the X# compiler. 90% of the examples can be compiled with the Core dialect. If an example needs to be compiled with the VO dialect, there will be a comment at the beginning of the file. Since the authors did not refrain from using comments inside the code, each example should be self-explanatory as well. The database examples use a small SQLite database, where the database consists of a single file that is part of the example directory. The needed SQLite data provider assembly is also part of the sample directory, so there shouldn't be any need to install something. The only issue could be that I have compiled all the examples on a 64-bit Windows.

Acknowledgements

I have to thank Robert van der Hulst for reading the (complete) draft of this book and writing more than 70 comments, corrections, and explanations. I took a few of his explanations as Info boxes into the book (without giving him credit each time). I also would like to thank Uwe Möller for his support and the whole EurekaFach team.

Potential errors

All examples have been tested by compiling them several times, that's the good news. The not so good news might be the quality of my writing. Since my mother language is German English is not my native language. I could (maybe should) have written this book in German, but since not only the X# development team but also the X# community comes from many countries, I decided to write the whole book in English. It was easy when I had to only write some explanations for the examples, it became a real challenge when the list of examples turned into a book. Thanks to modern technology, the text should be readable even for native speakers. I cannot praise platforms like Grammarly.com enough (there are several others too), that make applying grammar checks to any English text really simple. Before the corrections, there were literally thousands of "issues" (!), some of them really embarrassing for me (like using the wrong tense, a wrong preposition or even misspelled simple words), after the corrections, the number of errors should be tolerable (I was only using the free version;). But as stated before, if you find any errors in the text or in the examples, please send me a short e-mail (without any formalities of course).


NOTE: The whole book was written in Markdown with the execellent Typora editor that makes PDF export a real pleasure.


About me

Peter started his professional career first as a book author in 1984 before becoming a professional developer. He already started programming in the 70s. As probably everybody at that time he used BASIC, then Assembler, later Forth, and a few other languages he can't remember anymore. He regrets that he ignored VO in the 90s and instead tried to convince everybody that Visual Basic is the best invention since sliced bread. He started using X# in the late '00s when he became a member of the EurekaFach team. He is still convinced that X# is the best language for developing business applications for the .Net Framework.