Try OpenEdge Now
skip to main content
GUI for .NET Programming
Accessing and Managing .NET Classes from ABL : Defining ABL-extended .NET objects : Features of ABL classes that implement .NET interfaces
 

Features of ABL classes that implement .NET interfaces

ABL allows you to implement .NET interfaces with some restrictions. For more information on these restrictions, see Limitations of support for .NET classes. The primary reason to implement a .NET interface is to define an ABL class with data and behavior that is accessible from the .NET context using the standard contract defined by the interface.
The restrictions on implementing .NET interfaces in ABL basically mean that you can implement .NET interfaces that define only the types of class members that are supported by ABL interfaces—properties, methods, and events (but no indexed properties). Attempting to implement a .NET interface that defines other types of class members raises an ABL compile-time error.
As with implementing ABL interfaces, you must implement all of the properties, methods, and events that a .NET interface defines. Note that like ABL interfaces, .NET interfaces can inherit member prototypes from other interfaces. In addition, you can define ABL interfaces that inherit .NET member prototypes from .NET interfaces. This means that ABL must support any inherited interfaces, and you must implement all the properties, methods, and events specified in the entire ABL and .NET interface hierarchy.
For example, the System.Collections.ICollection interface inherits from the System.Collections.IEnumerable interface. Therefore, if you implement ICollection you must also provide an implementation for the single GetEnumerator( ) method defined by IEnumerable. Note, in this case, that GetEnumerator( ) returns an object defined as a System.Collections.IEnumerator interface type. So you must also implement the IEnumerator interface, as well, typically in a separate class definition that provides the member implementations in the object that GetEnumerator( ) returns.