vb.netobjectis-emptyisnullorempty

How do I check for an empty object in VB?


How do I check for an empty object in VB? Specifically, a function may sometimes return the following:

Return {}

How I check whether {} is returned as compared to an object with properties and data? Thanks.


Solution

  • That just returns an empty array. The array will depend on the return type of the function or it will be Object(). Just check if .Length is equal to 0.

    I assume you have Option Strict Off, you should turn it on :)