Global using directive
|Top Previous Next|
User interface > Translation options > Output options > Global using directive
Beginning with version 10.0 of C# there is the option to declare namespaces globally, so that they haven't to be declared in the according files any more, where these namespace are needed. According to the file layout of the files generated from Delphi2C# using directives for the interface parts and implementation parts of used files are created. If output option called "Global using directive" is activated in Delphi2C#, the using directives aren't written any more into the translated files, but a special file called "GlobalUsingDirective.cs" will be created at the end of the translation, where all using directives are assembled. This file then can be added then to the C# project.
GlobalUsingDirective.cs looks like:
global using FirstFile;
global using SecondFile;
global using static FirstFile.FirstFileInterface;
global using static SecondFile.SecondFileInterface;
In the according files only the namespaces for the implementation parts remain, like:
using static FirstFile.FirstFileImplementation
using static SecondFile.SecondFileImplementation
When global using directives are used, there is a risk of name conflicts. These can be resolved by means of of a file with interface symbols.
This page belongs to the Delphi2C# Documentation
|Delphi2C# home Content|