null values

Get our Free Newletter

Don't you have the time to be online here at DUG every day? So how do you follow what is going on in the Dynamics industry and community?
If you subscribe to the DUG Newsletter then you can relax! We will make sure that you don't miss the big news!

Check out our
Newsletter Subscription Center
page a complete list of our different newsletters.

Solution (Verified) This post has 1 verified solution | 2 Replies | 2 Followers

34 Posts
250 Points
Joined: 2012-6-21
Last Online:
2013-5-17 7:59
Location: Germany
F. Peters posted on 2012-9-10 10:49

Hi all,
is it possible to compare to "null"-values? E.g. i have a class and want to check something like

if (!someClass.Property() is null)
    // etc.

Thanks in advance!

Frank

Solution (Verified) Verified Solution

729 Posts
18,535 Points
Joined: 2010-3-2
Last Online:
2013-5-17 16:25
Location: Cheltenham, UK
Solution (Verified) Martin Dráb replied on 2012-9-10 13:24
Verified by F. Peters

There is no "is" operator in AX4. But you can simply use

if (someClass.Property() != null)

if Property() returns an X++ reference type. In case of CLR types, take a look at CLRInterop::isNull(), if it does exist in AX4.

BTW "is" operator in AX2012 or C# is used for checking types (e.g. foo is RunBase), not values.

All Replies

729 Posts
18,535 Points
Joined: 2010-3-2
Last Online:
2013-5-17 16:25
Location: Cheltenham, UK
Solution (Verified) Martin Dráb replied on 2012-9-10 13:24
Verified by F. Peters

There is no "is" operator in AX4. But you can simply use

if (someClass.Property() != null)

if Property() returns an X++ reference type. In case of CLR types, take a look at CLRInterop::isNull(), if it does exist in AX4.

BTW "is" operator in AX2012 or C# is used for checking types (e.g. foo is RunBase), not values.

34 Posts
250 Points
Joined: 2012-6-21
Last Online:
2013-5-17 7:59
Location: Germany
F. Peters replied on 2012-9-10 14:22

Fine, that works.

> BTW "is" operator in AX2012 or C# is used for checking types (e.g. foo is RunBase), not values.
Of course you are right (too much languages in the last months ;))

Thanks,
Frank

Page 1 of 1 (3 items) | Get this RSS feed | Bookmark and Share