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.
The object developed in this recipe, allows us to select any table and export its contents into an XML file.