03.12.2015, 11:11 | #1 |
Участник
|
mfp: X++ in AX7: The var keyword
Источник: http://blogs.msdn.com/b/mfp/archive/...r-keyword.aspx
============== This is the new language feature that is generating most discussions. Just like C# you can now use the var keyword when declaring variables. It has the exact same semantics, and any guideline you will find on how to use it in C# will also apply in X++. In C# the var keyword was introduced to enable scenarios where declaring the type was impossible, near-impossible or irrelevant, like with anonymous types and generics. Writing less was naturally well received by a lot of developers, and the use of var blossomed. It is also a great topic for steering up a debate. There are lots of guidelines and opinions. They cover the entire range from one extreme: "Always use it, it makes code easier to read" to the opposite extreme: "Never use it, it makes code harder to read". X++ does not support anonymous types or generics in AX7 - so the real need for the var keyword is not present - yet it is supported, and already heavily used. Like in C# the use of var is as strongly typed as when the type is explicitly provided. Personally, I'm recommending using var in only two cases:
THIS POST IS PROVIDED AS-IS AND CONFERS NO RIGHTS ============== Источник: http://blogs.msdn.com/b/mfp/archive/...r-keyword.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|