16.12.2015, 13:11 | #1 |
Участник
|
mfp: X++ in AX7: Extension methods
Источник: http://blogs.msdn.com/b/mfp/archive/...n-methods.aspx
============== Have you ever experienced a Microsoft provided class or table missing that vital method that would just make your life easier? If so, you might have been tempted to add it yourself using overlayering. And you surely have paid the upgrade price! You are about to be pleased. In AX7 X++ supports extension methods, similarly to C#. Suppose we want to add a fullName method to the DirPersonName table. Here is how you do it, without touching the DirPersonName table. Create this new class: static class MyDirPersonName_Extension { static public PersonName fullName(DirPersonName _person) { return strFmt('%1 %2 %3', _person.FirstName, _person.MiddleName, _person.LastName); } } Things to remember:
DirPersonName dirPersonName; while select dirPersonName { info(dirPersonName.fullName()); } Notice:
THIS POST APPLIES TO MICROSOFT DYNAMICS AX7 TECHNICAL PREVIEW; IS PROVIDED AS-IS AND CONFERS NO RIGHTS. ============== Источник: http://blogs.msdn.com/b/mfp/archive/...n-methods.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Похожие темы | ||||
Тема | Ответов | |||
mfp: X++ in AX7: Readonly keyword | 3 | |||
mfp: X++ in AX7: Client/Server keywords | 23 | |||
mfp: X++ in AX7: Static event subscription | 0 | |||
mfp: X++ in AX7: The var keyword | 43 | |||
mfp: X++ in AX7 | 0 |
|