Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hueman domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/CloudIngenium.com/htdocs/wp-includes/functions.php on line 6114
What is the meaning of the “Guid?” type? – Knowledge eXchange

What is the meaning of the “Guid?” type?

Recently when working with the Entity Framework I had a parameter marked as ‘Guid?’, after reasearching the Internet this is what I came up with as to what a type is with a ‘?’ (question mark) character at the end:

? is use to assign null for premitive data types like int, string, Guid, etc.

So for example,  you could do the following:

int? i = null;

However not this:

int i = null;

The last one would cause a compile error. So, why would you use this? Well, for the entity framework it makes sense as a non-initialized property is hard to identify. For example, in the case of an integer (Say property age) zero could be a valid value (just born), however, how do you distinguish between a valid zero and a non initialized integer? That’s when the null is helpful.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.