This article provides an example for importing Namespaces within a COBOL project in MS Visual Studio.
Problem:
It is convenient to have imported namespaces in a COBOL project within MS Visual Studio so you can use classes belonging to a namespace without to specify it. How is this done?
Resolution:
On the COBOL project, right click, select Properties, then choose References and choose namespace(s) you would like to import.
As an example, in the example code attached to this article, System.XML namespace was imported so you can directly use taking per example XmlDocument instead of System.Xml.XmlDocument leading to the COBOL .NET syntax to be lighter.
A .ZIP is also attached to this article containing a Visual Studio solution with two COBOL projects:
- 1st project: named CobolImportNAmespaceNo and the namespace System.XML was not imported n the project
- 2ndproject: named CobolImportNAmespaceYes and the namespace System.XML was imported n the project