O'Reilly logo

Extending Microsoft Dynamics NAV 2016 Cookbook by Alexander Drogin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Invoking .NET methods via reflection

Reflection is the ability of a program to control its own structure and change the flow dynamically at runtime. .NET Framework provides reflection capabilities through the System.Reflection assembly. The key class implemented in this assembly is Type, which gives access to the instantiation of datatypes and allows inspecting type methods and properties.

How to do it...

The following example executes one of two functions on a List object, when the function name becomes known only in runtime.

  1. Create a Page object in the C/SIDE page designer. This will be a container for actions executing reflected functions.
  2. The code of the function is as follows:
            Item.FINDSET;        REPEAT        ItemList.Add(Item.Description); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required