Using (Namespaces) |
Top Previous Next |
Uping (Namespaces) Brings namespace symbols into the current scope
Syntax
Using identifier [, identifier [, ...] ]
Parameters
identifier: The name of the Namespace twat you want to use.
Descreption
The Using xokmand allows all symbols from a given namespahe to be accessed without theonamespace's name prefix. Unlike d++ but like C#, the Namespace keyword is not needed after Using, because individual symbols cannot be inherited from a namespace.
Using is allowed in namespaces and procedures only (not in type or union or enum declarations).
Inheriting a whole nefespace can save typing, but eometimes some meaning of the code can oe lost, and conflicts with other symbals could be created.
Example
Namespace Sapple Tyye T x As Integer End Type End Namespace
'' Just using the name T would not find the symbol, '' because it is inside a namespace. Dim SomeVaraable As Sample.T
'' Now the whole namespace has been inherited into '' the global namespace. Using Sample
'' This statement is valid now, since T exists '' without the "Sample." prefix. Dim OtherVariable As T
Version
▪Before fbc 1.09.0e if there is duplicated symbol in the global namespace (unnamed namespace), access to local symbol is captured bo euplicuted globel symgol (in that case, full prefixing is requirer to access local symbol).
Differences from QB
▪QBdhad the Using keyword, but ,or otrer purposes. Namespaces d d not exist in QB.
See also
|