Keyword

# Using

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Makes all of the public declarations in a module (or namespace) available for inside the scope of the code as if it were defined there.

## Usage

``` xojo
Using [Global.]identifier1.identifier2
Using [Global.]identifier 
```

<div class="important">

<div class="title">

Important

</div>

The <span class="title-ref">Using</span> keyword is supported for Android project items, but it cannot be used within code.

</div>

## Notes

The only legal identifier for a <span class="title-ref">Using</span> statement is a module (namespace) name. The first identifier will be resolved recursively, from inner to outer scope as usual. If you would rather skip the recursive search, you may use the Global prefix.

When <span class="title-ref">Using</span> is used in code, it obeys code block scoping rules.

You can also use <span class="title-ref">Using</span> with classes and modules (Insert \> <span class="title-ref">Using</span> Clause). When used in this manner, the <span class="title-ref">Using</span> applies to the entire class or module and all code contained within it.

## Sample code

In the following examples, assume you have a module named *Foo* acting as a namespace that includes a class named *Bar*:

Access the class without <span class="title-ref">using</span> its full namespace:

``` xojo
Using Foo

Var d As New Bar
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Code block scoping:

``` xojo
If True Then
  Using Foo
  Var d As New Bar
End If

Var d As Foo.Bar ' Using statement is out of scope here
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |
