I’ve seen a lot of posts for how to do this in C#, but I’m working in VB and they don’t work and I can’t seem to get them to convert. Anyone know this? C# is something like:
if (x is IEnumerable)
{
}
I’m looking to see if an object passed to my function implements IEnumerable so I can treat it like a collection.
I’ve already tried “x Is IEnumerable” and VB won’t allow it anywhere… it expects a type of IEnumerable, such as IEnumerable(Of String).
Even better, use
TryCast. TryCast Operator