Hi, Readers.
Dynamics 365 Business Central 2025 wave 1 (BC26) is generally available. More details: General Available: Dynamics 365 Business Central 2025 release wave 1 (BC26).
I will continue to test and share some new features that I hope will be helpful.
Create lists and dictionaries of interfaces in AL:
Business value:
https://learn.microsoft.com/en-us/dynamics365/release-plan/2025wave1/smb/dynamics365-business-central/create-list-dictionary-interfaces-al?wt.mc_id=DX-MVP-5004336
In the Business Central AL language, dictionaries and lists are powerful data structures that offer efficient lookup of key-value pairs and ordered collections, and both allowing managing collections of data dynamically. We’re now adding the ability to have lists and dictionaries of interfaces, providing more flexibility and power when you work with interface abstractions.
This is also mentioned in AL Language extension changelog Version 15.0:
Allow having a dictionary where the value type is an interface.
https://marketplace.visualstudio.com/items/ms-dynamics-smb.al/changelog

An interface in AL is similar to an interface in any other programming language; it’s a syntactical contract that can be implemented by a nonabstract method. The interface is used to define which capabilities must be available for an object, while allowing actual implementations to differ, as long as they comply with the defined interface. More details: Interfaces in AL
This was a new object type in Business Central 2020 Wave1 (BC16). And we discussed it in the last major update.
- Business Central 2024 wave 2 (BC25): Extend AL interfaces
- Business Central 2024 wave 2 (BC25): Type testing and casting operators for interfaces (‘is’ operator and ‘as’ operator)
With this wave (BC26), we can now create lists or dictionaries of interfaces.
PS:
List Data type: Represents a strongly typed list of ordered objects that can be accessed by index.
Dictionary Data type: Represents an unordered collection of keys and values.
The syntax follows these patterns, aligned with creating a List or Dictionary of a simple type:
- List of [Interface IFoo]
- Dictionary of [; Interface IFoo]
Let’s look at two simple examples:
List Data type:


PS:
1. In the System Application, you can find the complete examples of using a list of interfaces in the Telemetry Logger

2. In BC25.5 and previous versions
The type ‘Interface’ cannot be used as a type argument in this context. AL AL0408

Great. Give it a try!!!😁
END
Hope this will help.
Thanks for reading.
ZHU
コメント