Hi all
I need to open DBF files in a C# project. I don't want to use Microsoft.Jet.OLEDB because if the dependency of it be installed and also it lacks a lot of functionality. The same goes for all the other "DBF Readers" I could find.
My problem is I am not allowed to use any other language except C# so a XSharp project is out of the question.
My question is, is it possible to reference the XSharp assemblies directly from C#? If so, can someone point me to a Example perhaps?
Regards
Charl
Open DBF directly from C# using XSharp Assemblies
-
charl.esterhuizen
- Posts: 2
- Joined: Mon Jul 14, 2025 6:13 am
- Location: South Africa
Re: Open DBF directly from C# using XSharp Assemblies
Charl,
Yes, that is possible. Unfortunately, we do not have an example for this.
But this is the short description of what you need to do.
To open DBFs you need to include XSharp.Core, XSharp.RT, XSharp.RDD and XSharp.Macrocompiler.
The easiest way to open the DBFs is to use the completely strongly static methods in the CoreDb class.
This class is in the XSharp namespace.
You will find methods for each of the normal DBF related operations: UseArea(), Skip(), FieldGet(), FieldPut() etc.
Properties like EoF, BoF etc are also represented as methods.
The Macrocompiler is needed when you use indexes, filters etc.
If you want to set "global state", such as SetDeleted(), SetSoft() etc., then there are methods in the Functions class. You can also access the properties in the XSharp.Runtimestate.
Please use the X# help file for documentation about CoreDb and RuntimeState.
Robert
Yes, that is possible. Unfortunately, we do not have an example for this.
But this is the short description of what you need to do.
To open DBFs you need to include XSharp.Core, XSharp.RT, XSharp.RDD and XSharp.Macrocompiler.
The easiest way to open the DBFs is to use the completely strongly static methods in the CoreDb class.
This class is in the XSharp namespace.
You will find methods for each of the normal DBF related operations: UseArea(), Skip(), FieldGet(), FieldPut() etc.
Properties like EoF, BoF etc are also represented as methods.
The Macrocompiler is needed when you use indexes, filters etc.
If you want to set "global state", such as SetDeleted(), SetSoft() etc., then there are methods in the Functions class. You can also access the properties in the XSharp.Runtimestate.
Please use the X# help file for documentation about CoreDb and RuntimeState.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Re: Open DBF directly from C# using XSharp Assemblies
Hi Charl,
I have done something similar in a X# Core dialect class - and the Core Dialect is the dialect that cannot use any xbase specific datatypes or functionalities. In theory you could translate my code to C#, or I could try to build an assembly, and you can use ILSpy to translate it to C#.
Wolfgang
I have done something similar in a X# Core dialect class - and the Core Dialect is the dialect that cannot use any xbase specific datatypes or functionalities. In theory you could translate my code to C#, or I could try to build an assembly, and you can use ILSpy to translate it to C#.
Wolfgang
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
Re: Open DBF directly from C# using XSharp Assemblies
Hi Charl,
I have now tried to compile this class to a single assembly, but I had to remove references to the XBase date datatype.
You can find the binary here: Wolfgang
P.S. even if XSharp can be used free of charge, please consider paying something to the development team if this software works for you. Writing the RDD and making it stable was a lot of work for them.
I have now tried to compile this class to a single assembly, but I had to remove references to the XBase date datatype.
You can find the binary here: Wolfgang
P.S. even if XSharp can be used free of charge, please consider paying something to the development team if this software works for you. Writing the RDD and making it stable was a lot of work for them.
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
-
charl.esterhuizen
- Posts: 2
- Joined: Mon Jul 14, 2025 6:13 am
- Location: South Africa
Re: Open DBF directly from C# using XSharp Assemblies
Thanks all for responding. I will look into the suggestions as soon as I have time

