Check if a QueueItem.SpecificContent("key") has a value

Can you try this type of thing and see if it handles it?

  If io_TransactionItem.SpecificContent.ContainsKey("Accounts") Then
        assign strContent = If(io_TransactionItem.SpecificContent("Accounts") Is Nothing, "", io_TransactionItem.SpecificContent("Accounts"))
           assign  boolEmpty = String.IsNullOrWhiteSpace(io_TransactionItem.SpecificContent("Accounts").ToString)
    End If

The dictionary may have but containing a null value, which is making the .toString fail.

Actually maybe be best to go with this type of Linq:

io_TransactionItem.SpecificContent.Any(Function(x) x.Key = “Accounts” AndAlso x.Value IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(x.Value.ToString))

Cheers

5 Likes