vendredi 13 septembre 2019

Do I need nullable and not nullable PropertyType checks? C#

I changed something in my app so it wont run now, however I'm wondering if this code:

 if (props.PropertyType == typeof(DateTime) || props.PropertyType == typeof(DateTime?))

should be written as this

if (props.PropertyType == typeof(DateTime?))

I would expect that checking for DateTime? covers DateTime as well or ?





Aucun commentaire:

Enregistrer un commentaire