Stenway Developer Network

Using Declaration

Using Declaration

using MyCompany.MyLib

namespace MyApp
  class App
    static method main(args)
      var obj1 = MyCompany.MyLib\MyClass1()
      var obj2 = MyClass1()
    end
  end
end

Using package root namespace and sub-namespaces

using MyCompany.MyLib
using MyCompany.MyLib\MySubNamespace

Specifying the package version

using MyCompany.MyLib\0.8.0.0

Prerelease version

using MyCompany.MyLib\0.8.0.0\0.1

Per-namespace usings

namespace MyApp
  using MyCompany.MyLib
  
  class MyApp
  end
  
  using MyCompany.MyLib\Utils
end

namespace MyApp\MySubNamespace
  using MyCompany.MyLib\Collections
end

A using declaration can be written before or after a namespace entity. The order is not relevant.