Condition to check if item is nothing

For datatable rows have you tried String.IsNullOrEmpty() - you’d have to convert your row to string first but that shouldn’t be a problem in most cases.

For the outlook problem I’m a little confused either you have a mail message or you don’t so when you are obtaining a list of mail messages you should know how many you have e.g. your mailMessages array will have 10 items. Therefore you know to check 10 messages and after that you will know that it is going to be nothing. Alternatively you would just loop through each message in mailMessages which would automatically end once you run out of messages.