IsNullOrEmpty is used with strings to check if a string is null or empty.
Is there an equivalent with an object to see if any object is null or not?
I assume we can do
obj1 != null
but not sure if there is any other way…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
a null string is null, an empty string is “”
isNullOrEmpty requires an intimate understanding about the implementation of a string. If you want one, you can write one yourself for your object, but you have to make your own definition for whether your object is “empty” or not.
ask yourself: What does it mean for an object to be empty?