PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Syntax
  • Declaring a dynamic object
  • Instantiating a dynamic object
  • Freeing a dynamic object
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Dynamic instantiation of .NET object
Overview
A .NET object can be dynamically associated with a .NET class, we talk of dynamic instantiation of object.
Instantiating a dynamic .NET object allows you to create an object at a given time and to free this object when it is no longer used.
To instantiate a .NET object, you must:
  1. declare a dynamic .NET object
  2. instantiate the .NET object
Note: The object is automatically freed at the end of the application when it is no longer used. However, you can force the object destruction (to trigger the destructor execution for example).
Syntax

Declaring a dynamic object

<Object Name> is [object] <Class Name> dynamic
Details of syntax
<Object Name>
Name used to identify the instance of the .NET class.
<Class Name>
Name identifying the class. If the .NET class is named like a WLanguage keyword, the name of the class must be enclosed in quotes (for example, o is "<Class>"(<Parameters>).

Instantiating a dynamic object

<Object Name> = new <Class Name>([<Parameters>])
Details of syntax
<Object Name>
Name used to identify the instance of the .NET class.
<Class Name>
Name identifying the class. If the .NET class is named like a WLanguage keyword, the name of the class must be enclosed in quotes (for example, o is "<Class>"(<Parameters>).
<Parameters>
Optional parameters of constructor.

Freeing a dynamic object

delete <Object Name>
Details of syntax
<Object Name>
Name that identifies the instance of the class.
Notes:
  • The object is automatically freed at the end of the application when it is no longer used. However, you can force the object destruction (to trigger the destructor execution for example).
  • To check whether a dynamic object is allocated and whether it has not been freed, this object must be compared to NULL. Example:
    IF <Object Name> = NULL THEN ...

    IF <Object Name> <> NULL THEN...
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment