Skip to main content

DependsOn (Class Keyword)

Specifies that this class should be compiled after the compiler has made other (specified) classes runnable.

Usage

To indicate that the class compiler should compile this class after other classes are runnable, use the following syntax:

Class MyApp.MyClass [ DependsOn = classlist ]  
{ //class members }

Where classlist is one of the following:

  • A class name. For example:

    [ DependsOn = MyApp.Class1 ]
    
  • A comma-separated list of class names, enclosed in parentheses. For example:

    [ DependsOn = (MyApp.Class1,MyApp.Class2,...) ]
    

Details

This keyword specifies that the class compiler should compile this class after making the specified classes runnable. For example, if class A refers to a class query defined in class B, class B must be runnable before class A can be compiled; in this case, class A depends on class B.

This keyword is useful if compilation of this class uses these other classes in the method generator logic. It is also useful if the class contains initial expressions that invoke other classes.

This keyword does not affect runtime behavior.

Note:

The DependsOn keyword affects only classes with common values for the System keyword.

Also, if a class has DependsOn=ClassA, it is redundant for it to have CompileAfter=ClassA as well. See the CompileAfter keyword.

Effect on Subclasses

This keyword is inherited from all superclasses. If the subclass specifies a value for the keyword, that value specifies additional classes that must be runnable before the subclass can be compiled.

Default

By default, this keyword is not specified.

See Also

FeedbackOpens in a new tab