Try OpenEdge Now
skip to main content
GUI for .NET Programming
Accessing and Managing .NET Classes from ABL : Accessing .NET class members
 

Accessing .NET class members

ABL supports access to public or protected members of a .NET class instance using much the same syntax for accessing public or protected members of an ABL class instance. This includes support for using built-in ABL data types that automatically map to specified .NET data types, for example, to get and set .NET property values or to pass .NET method parameters. For more information on data type mapping, see Using .NET data types in ABL.
Note: The Progress Developer Studio for OpenEdge provides a Class Browser view that you can use to list the members of a .NET class, showing the signature for each member using ABL syntax.
So, you can access the following members of a .NET class instance in exactly the same way as you access them for an ABL class instance:
*.NET constructors — Invoke a .NET class constructor by instantiating a .NET class exactly like an ABL class using the NEW function (classes). From the constructor of an ABL-derived .NET class, you can also access a constructor of the immediate super class using the SUPER statement. For more information, see Instantiating and managing .NET class instances, and Specifying .NET constructor and method parameters.
*.NET fields — Equivalent to ABL data members, read or write the values of .NET fields of a class using class-based data member access, as described in OpenEdge Development: ABL Reference.
*.NET methods — Invoke .NET methods of a class using class-based method calls, as described in OpenEdge Development: ABL Reference. Also, see Specifying .NET constructor and method parameters.
*.NET properties — Set or get the values of .NET properties of a class using class-based property access, as described in OpenEdge Development: ABL Reference. You can also access .NET properties dynamically using Accessing .NET indexed properties dynamically.
*.NET object events — Like ABL classes, .NET classes can define, publish, and handle events. .NET applications handle events by subscribing .NET methods as event handlers. ABL applications can handle .NET events by subscribing ABL methods and internal procedures as event handlers. These ABL event handlers respond to published .NET events in a manner similar to .NET event handlers in .NET applications. For more information, see Handling .NET events.
Note: In .NET, you separate the reference to a .NET field, method, or property from its associated object reference (for an instance member) or class type name (for a static member) using a period (.) instead of a colon (:), as in ABL.
ABL allows you to use native syntax to access class members in support of certain .NET features not supported in native ABL applications. These include:
*.NET interface members — .NET supports types of interface members that ABL interfaces do not support. For more information on accessing these interface members in ABL, see the .
*.NET enumeration types — Enumerations are special .NET classes that can represent a particular enumerated subset of values of a given .NET data type. Each value of that subset is represented as a member of a given enumeration type. For more information on enumeration types and how to use them in ABL, see Accessing and using .NET enumeration types.
ABL also provides extended syntax to access .NET class member features that are currently not supported for ABL class members or that require additional syntax to access them in the .NET context. The following sections thus describe the extended syntax for:
*Static members of a .NET class — .NET supports static class members, which are accessible in ABL only on the class type exactly like static members of ABL classes. The only difference for .NET static members in ABL is the additional syntax for accessing .NET inner class types (see Referencing .NET class and interface types). For general information on accessing static class members in ABL, see OpenEdge Development: Object-oriented Programming. For more information on accessing .NET static class members in ABL, see Accessing static members of a .NET class.
*Explicit mappings to .NET data types — In many cases, wherever a given .NET data type maps to an ABL primitive type, you can use the corresponding ABL primitive type to exchange data with the .NET type. However, some usage requires that you explicitly indicate the .NET data type that you intend to use. For example:
*You must use appropriate mappings between ABL and .NET parameter options to pass ABL data to overloaded .NET constructor and method parameters. ABL extends its parameter-passing syntax to specify explicit mappings between ABL primitive types and the corresponding .NET mapped data types of parameters. For more information on how and why ABL supports these mappings, see Specifying .NET constructor and method parameters.
*You must use explicit mappings for .NET mapped data types when you override .NET methods or .NET abstract properties in an ABL-derived .NET class. For more information, see Deriving .NET classes in ABL.
*You must use explicit mappings for .NET mapped data types when you reference the constructed type name of a .NET generic type. For more information, see Referencing .NET generic types.
*.NET indexed properties and collections — .NET supports properties that can provide access to a keyed group of values. .NET commonly uses these indexed properties to support object collections. For more information on using both .NET indexed properties and collections in ABL, see Accessing .NET indexed properties and collections.
* Accessing members of .NET interfaces
* Accessing static members of a .NET class
* Specifying .NET constructor and method parameters
* Accessing .NET indexed properties and collections