I have a function (not written by me) that's returning either a String or a
ValueObject, depending on whether or not it finds a match in an ArrayCollection
of ValueObjects. If it finds a match, it returns the ValueObject that matches
the search string. If it doesn't find a match, it returns the search-string
itself.
So, here's my question -- how do I know if what's being returned is a String or
a ValueObject?
I need something like the following:
if returnedItem isString {
//do stuff needed for when match isn't found
} else {
//do stuff needed for when match is found
}
But I can't figure out how to word that 'if' statement -- how do you ask it if
it is a String or a ValueObject, without knowing in advance what it's going to
be?
Thanks,
Laurence MacNeill
Mableton, Georgia, USA