Using .NET assemblies in C/AL
As an introduction to .NET assemblies in C/AL, we will develop a function to export the contents of any table to an XML file. The Exchanging data with XMLPort objects recipe in Chapter 2, Advanced C/AL Development, covered a similar topic of XML export with the XMLPort
objects. While XMLPorts win in terms of simplicity, .NET objects are victorious in flexibility. The development of an object based on .NET interoperability requires more effort, but the result is applicable to any table, while XMLPorts are bound to a fixed table.
How to do it...
The object developed in this recipe, allows us to select any table and export its contents into an XML file.
- First, create a page that will list all tables where the user can select a table to be exported. Create a List type page and select the AllObj table for the page data source. In the List page wizard, select two fields, Object ID and Object Name, to be displayed on the page.
- Finish the wizard and...