Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Extension methods recap in Microsoft Dynamics 365 Finance and Operations apps

Rahul Mohta Profile Picture Rahul Mohta 21,026

Extension methods recap in Microsoft Dynamics 365 Finance and Operations apps

extension method feature lets you add extension methods to a target class/table by writing the methods in a separate extension class. The following rules apply:

The extension class must be static.

The name of the extension class must end with the ten-character suffix _Extension.

However, there’s no restriction on the part of the name that precedes the suffix.

Every extension method in the extension class must be declared as public static.

The first parameter in every extension method is the type that the extension method extends.

However, when the extension method is called, the caller must not pass in anything for the first parameter. Instead, the system automatically passes in the required object for the first parameter.

 

It’s perfectly valid to have private or protected static methods in an extension class. These are typically used for implementation details and are not exposed as extensions.

 

 

can use extends (inheritance) also for creating new class methods in your own model/package.

e.g. in SSRS when using RDP and UI builder class, you should extend the class SrsReportDataContractUIBuilder

Comments

*This post is locked for comments